Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 109155 - Could reiserfsprogs display volume labels when doing fsck upon boot?
Summary: Could reiserfsprogs display volume labels when doing fsck upon boot?
Status: VERIFIED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-13 09:00 UTC by Wiktor Wandachowicz
Modified: 2005-10-14 07:35 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
reiserfscore-prints.c-display_volume_label.diff (reiserfscore-prints.c.diff,150 bytes, patch)
2005-10-13 09:03 UTC, Wiktor Wandachowicz
Details | Diff
reiserfscore-prints.c-display_volume_label.diff with C-style comment (reiserfscore-prints.c-display_volume_label.diff,150 bytes, patch)
2005-10-13 09:13 UTC, Wiktor Wandachowicz
Details | Diff
reiserfscore-prints.c-display_volume_label.diff with correct C-style comment (reiserfscore-prints.c-display_volume_label.diff,153 bytes, patch)
2005-10-13 09:15 UTC, Wiktor Wandachowicz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wiktor Wandachowicz 2005-10-13 09:00:47 UTC
I have several partitions for my Gentoo installation, with separate /boot
(ext2), / {ROOT} (ext3) and /usr/portage (ext3). Recently I needed to resize the
last partition and I thought about testing reiserfs 3.6.

All of my partitions have labels (hint: "mke2fs -L") so at boot I can easily see
which partitions are fsck-ed. So while reformatting my last partition /dev/hda8
as reiserfs 3.6, I've labeled it "PORTAGE" (hint: "mkreiserfs -l").

Alas, upon boot fsck.reiserfs never displayed a volume label set this way.

But I've checked the source and actually all the needed data were already in
place. I mean: the reiserfs_super_block structure contains the needed s_label
field. So I've changed a bit reiserfscore/prints.c file and voila! Now the
volume label shows exactly as I would like it to see. And if there's no volume
label, nothing is printed and the message is exactly the same as in the
original, unmodified reiserfsprogs.

I know, I know, it's cosmetic :-)

But for me it's more consistent this way. And it was VERY easy to add :-)


Reproducible: Always
Steps to Reproduce:
1. Create a reiserfs 3.6 filesystem, with or without -l (label) option.
2. Mention this filesystem in the /etc/fstab, and set the last field <pass>
   to some positive integer.
3. # emerge -av =sys-fs/reiserfsprogs-3.6.19
4. # fsck -C -T -R -A -a

Actual Results:  
Both fsck.ext2 and fsck.ext3 display volume label, if they can find it.
While fsck.reiserfs never displays any volume label (see third line/disk):

# fsck -C -T -R -A -a
BOOT: clean, 62/297256 files, 60311/594405 blocks
/dev/hda5 is mounted.  e2fsck: Cannot continue, aborting.
Reiserfs super block in block 16 on 0x308 of format 3.6 with standard journal
Blocks (total/free): 1275136/773937 by 4096 bytes
Filesystem is clean
Replaying journal..
Reiserfs journal '/dev/hda8' in blocks [18..8211]: 0 transactions replayed
Checking internal tree..finished
SPARE: clean, 16/1540096 files, 1813541/3074431 blocks


Expected Results:  
Display volume label if it is set, like "PORTAGE" for my /dev/hda8 (3rd line):

# fsck -C -T -R -A -a
BOOT: clean, 62/297256 files, 60311/594405 blocks
/dev/hda5 is mounted.  e2fsck: Cannot continue, aborting.
PORTAGE: Reiserfs super block in block 16 on 0x308 of format 3.6 with standard
journal
...
SPARE: clean, 16/1540096 files, 1813541/3074431 blocks


I will add a patch for the sys-fs/reiserfsprogs-3.6.19. I think it really
should be safe wrt. to reiserfs v.3.5 and v.3.6, and is also applicable
to the reiserfsprogs-3.6.18 and reiserfsprogs-3.6.17.
The maintainers should decide whether this behaviour is desired or not.

Even if it's non-standard (I mean: original fsck.reiserfs doesn't have it),
for me it's important enough to bother myself. I can safely handle it for my own
needs, but I thought: "hey, maybe someone will find it useful too?"

If someone is extra-paranoid, then this patch can be enhanced to be extra-safe
and strictly compatible with reiserfs v.1.0 and v.1.1. And I have NEVER seen
such versions of reiserfs, btw.
Comment 1 Wiktor Wandachowicz 2005-10-13 09:03:36 UTC
Created attachment 70571 [details, diff]
reiserfscore-prints.c-display_volume_label.diff

The patch should be applied to the reiserfsprogs-3.6.19/reiserfscore/prints.c
in the unpacked source directory.
Comment 2 Wiktor Wandachowicz 2005-10-13 09:07:23 UTC
Comment on attachment 70571 [details, diff]
reiserfscore-prints.c-display_volume_label.diff

>620a621,624
>>     /* Print volume label if it is non-empty. */
>>     if (sb->s_label[0]) {
>>         reiserfs_warning (fp, "%s: ", sb->s_label);
>>     }
Comment 3 Wiktor Wandachowicz 2005-10-13 09:08:52 UTC
Comment on attachment 70571 [details, diff]
reiserfscore-prints.c-display_volume_label.diff

>620a621,624
>>     // Print volume label if it is non-empty.
>>     if (sb->s_label[0]) {
>>         reiserfs_warning (fp, "%s: ", sb->s_label);
>>     }


620a621,624
>     /* Print volume label if it is non-empty. */
>     if (sb->s_label[0]) {
>         reiserfs_warning (fp, "%s: ", sb->s_label);
>     }
Comment 4 Wiktor Wandachowicz 2005-10-13 09:09:40 UTC
The above should change the print_super_block function, as following:

/* return 1 if this is not super block */
int print_super_block (FILE * fp, reiserfs_filsys_t * fs, char * file_name,
                              struct buffer_head * bh, int short_print)
{
    struct reiserfs_super_block * sb =
                                    (struct reiserfs_super_block *)(bh->b_data);
    dev_t rdev;
    int format = 0;
    __u16 state;

    if (!does_look_like_super_block (sb))
        return 1;

    rdev = misc_device_rdev(file_name);

    /* Print volume label if it is non-empty. */
    if (sb->s_label[0]) {
        reiserfs_warning (fp, "%s: ", sb->s_label);
    }
    reiserfs_warning (fp, "Reiserfs super block in block %lu on 0x%x of ",
                      bh->b_blocknr, rdev);
    switch (get_reiserfs_format (sb)) {
Comment 5 Wiktor Wandachowicz 2005-10-13 09:11:18 UTC
Brr. Ugly. I can't figure out how to change the patch as I incorrectly put the
C++ style comment instead of C-style.

Patch resubmitted.
Comment 6 Wiktor Wandachowicz 2005-10-13 09:13:25 UTC
Created attachment 70572 [details, diff]
reiserfscore-prints.c-display_volume_label.diff with C-style comment

Resubmitted the patch. Sorry for the mess... I'm still learning.
Comment 7 Wiktor Wandachowicz 2005-10-13 09:15:54 UTC
Created attachment 70573 [details, diff]
reiserfscore-prints.c-display_volume_label.diff with correct C-style comment

Aaaaahhhh! Wrong comment again! I suppose this will be thrown out of the
window...

Resubmitted the patch.
Comment 8 Jakub Moc (RETIRED) gentoo-dev 2005-10-13 09:20:15 UTC
Why don't you take this upstream (reiserfs-list@namesys.com)?
Comment 9 SpanKY gentoo-dev 2005-10-13 17:16:08 UTC
yeah, this isnt something to add to Gentoo
Comment 10 Wiktor Wandachowicz 2005-10-14 02:12:17 UTC
I think you're right. I'll try to post that upstream.
Comment 11 Wiktor Wandachowicz 2005-10-14 07:35:15 UTC
Well, I did what I could. See here:

http://article.gmane.org/gmane.comp.file-systems.reiserfs.general/16553
http://news.gmane.org/gmane.comp.file-systems.reiserfs.general

A small discussion started which also touched ReiserFS v.4 and its
handling of volume labels. Good to know that it may incorporate my desired
behaviour one day too. Even though I don't use it right now.

And at the end Vitaly Fertman (the developer) said he will apply my patch.
Finally in the PM he said that's already done. Very, very nice :-)


Now all that's left is to wait for updated version of reiserfsprogs.

Thanks for the motivation, jakub && vapier !!