Skip to contentSkip to conversation

Skip "rootfs" entry when checking for ext4 filesystem.

PATCH In review Eric Sandeen 2 participants 4 messages Sep 8, 2009 – Oct 11, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Skip "rootfs" entry when checking for ext4 filesystem.

Skip "rootfs" entry when checking for ext4 filesystem.

---

misc/e4defrag.c +2 -0
index 82e3868..0d04df9 100644
@@ -430,6 +430,8 @@ static int is_ext4(const char *file)
 	}
 
 	while ((mnt = getmntent(fp)) != NULL) {
+		if (mnt->mnt_fsname[0] != '/')
+			continue;
 		len = strlen(mnt->mnt_dir);
 		ret = memcmp(file_path, mnt->mnt_dir, len);
 		if (ret != 0)
#1 lore raw

Ping on this one?

Ravi reported a failure w/o it:

Quoted 11 lines

Hi,

I'm playing with e4defrag from e2frprogs git, and I've run into a bug. When I try to defragment files on my root filesystem, it refuses to acknowledge that the filesystem is ext4. I believe the problem is that it checks the filesystem type by parsing /etc/mtab, but the root filesystem shows up there like this:

rootfs on / type rootfs (rw)
/dev/root on / type ext4 (rw,noatime,barrier=1,data=ordered)

Quoted 7 lines

so it gets confused by the bogus first entry. It works just fine on other ext4 filesystems I have.

(If this is the wrong mailing list, I apologize; I couldn't find one for e2fsprogs, so I thought this was the next best thing.)

--Ravi

Thanks,
-Eric

Quoted 23 lines · Eric Sandeen

Skip "rootfs" entry when checking for ext4 filesystem.

---

misc/e4defrag.c +2 -1
index 82e3868..0d04df9 100644
@@ -430,6 +430,8 @@ static int is_ext4(const char *file)
 	}
 
 	while ((mnt = getmntent(fp)) != NULL) {
+		if (mnt->mnt_fsname[0] != '/')
+			continue;
 		len = strlen(mnt->mnt_dir);
 		ret = memcmp(file_path, mnt->mnt_dir, len);
 		if (ret != 0)
 
--

To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 1 line · Eric Sandeen

Ping on this one?

Ping++

-Eric

Quoted 53 lines

Ravi reported a failure w/o it:

Quoted 11 lines

Hi,

I'm playing with e4defrag from e2frprogs git, and I've run into a bug. When I try to defragment files on my root filesystem, it refuses to acknowledge that the filesystem is ext4. I believe the problem is that it checks the filesystem type by parsing /etc/mtab, but the root filesystem shows up there like this:

rootfs on / type rootfs (rw)
/dev/root on / type ext4 (rw,noatime,barrier=1,data=ordered)

Quoted 7 lines

so it gets confused by the bogus first entry. It works just fine on other ext4 filesystems I have.

(If this is the wrong mailing list, I apologize; I couldn't find one for e2fsprogs, so I thought this was the next best thing.)

--Ravi

Thanks,
-Eric

Quoted 20 lines · Eric Sandeen

Skip "rootfs" entry when checking for ext4 filesystem.

---

misc/e4defrag.c +2 -1
index 82e3868..0d04df9 100644
@@ -430,6 +430,8 @@ static int is_ext4(const char *file)
 	}
 
 	while ((mnt = getmntent(fp)) != NULL) {
+		if (mnt->mnt_fsname[0] != '/')
+			continue;
 		len = strlen(mnt->mnt_dir);
 		ret = memcmp(file_path, mnt->mnt_dir, len);
 		if (ret != 0)
 
--
Quoted 3 lines

To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 4 lines · Eric Sandeen
Quoted 1 line · Eric Sandeen

Ping on this one?

Ping++

Looks reasonable. I thought it would skip the second "/" entry as well, but in fact this is looking at the "dev" field and it is skipping the "rootfs" (as well as other virtual filesystems like procfs and devfs).

Quoted 58 lines
Quoted 44 lines

Ravi reported a failure w/o it:

Quoted 11 lines

Hi,

I'm playing with e4defrag from e2frprogs git, and I've run into a bug. When I try to defragment files on my root filesystem, it refuses to acknowledge that the filesystem is ext4. I believe the problem is that it checks the filesystem type by parsing /etc/mtab, but the root filesystem shows up there like this:

rootfs on / type rootfs (rw)
/dev/root on / type ext4 (rw,noatime,barrier=1,data=ordered)

Quoted 7 lines

so it gets confused by the bogus first entry. It works just fine on other ext4 filesystems I have.

(If this is the wrong mailing list, I apologize; I couldn't find one for e2fsprogs, so I thought this was the next best thing.)

--Ravi

Thanks,
-Eric

Quoted 19 lines · Eric Sandeen

Skip "rootfs" entry when checking for ext4 filesystem.

---

misc/e4defrag.c +2 -0
index 82e3868..0d04df9 100644
@@ -430,6 +430,8 @@ static int is_ext4(const char *file)
 	}
 
 	while ((mnt = getmntent(fp)) != NULL) {
+		if (mnt->mnt_fsname[0] != '/')
+			continue;
 		len = strlen(mnt->mnt_dir);
 		ret = memcmp(file_path, mnt->mnt_dir, len);
 		if (ret != 0)
Quoted 9 lines
Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html