[Top] [All Lists]

[PATCH] xfsprogs: skip over "rootfs" entry if mtab links to /proc/mounts

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfsprogs: skip over "rootfs" entry if mtab links to /proc/mounts
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Wed, 03 Aug 2011 13:41:59 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20110624 Thunderbird/5.0
This is for RH bug 727938, xfs_fsr regression for root file system

Fedora has made /etc/mtab a symlink to /proc/mounts, but when
we issue "xfs_fsr /" and fsr's getmntany() goes looking for
the "/" entry, the first one it finds is

rootfs / rootfs rw 0 0

it says no way, that's a rootfs filesystem type, not xfs!
And it never finds this later:

/dev/sda2 / xfs rw,relatime,attr2,noquota 0 0

This patch to skip over the rootfs entry seems to fix it.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>

diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 40c2e6f..eaf8ac7 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -1648,6 +1648,9 @@ getmntany(FILE *fp, struct mntent *mp, struct mntent 
*mpref, struct stat64 *s)
        struct stat64 ms;
        while ((t = getmntent(fp))) {
+               /* skip over "rootfs / rootfs" if mtab is really /proc/mounts */
+               if (strcmp(t->mnt_type, "rootfs") == 0)
+                       continue;
                if (mpref->mnt_fsname) {        /* device */
                        if (stat64(t->mnt_fsname, &ms) < 0)

<Prev in Thread] Current Thread [Next in Thread>