cluster: STABLE3 - /sbin/mount.gfs2: can't find /proc/mounts entry for directory /

Bob Peterson rpeterso@fedoraproject.org
Mon Jun 29 19:12:00 GMT 2009


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=51177a5e1b86b1eb4768f4d593b85d71e190fda3
Commit:        51177a5e1b86b1eb4768f4d593b85d71e190fda3
Parent:        d060cdd752140cf23f56650635755fd807000624
Author:        Bob Peterson <rpeterso@redhat.com>
AuthorDate:    Mon Jun 29 13:59:14 2009 -0500
Committer:     Bob Peterson <rpeterso@redhat.com>
CommitterDate: Mon Jun 29 14:03:30 2009 -0500

/sbin/mount.gfs2: can't find /proc/mounts entry for directory /

bz 507893

The gfs2 mount helper was identifying devices by name rather than
by number.  That works fine most of the time, but not in all
cases, like when the root file system is gfs2.  This patch uses
device ids to identify the devices, as it should be.
---
 gfs2/mount/util.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/gfs2/mount/util.c b/gfs2/mount/util.c
index 5c86027..fad4032 100644
--- a/gfs2/mount/util.c
+++ b/gfs2/mount/util.c
@@ -218,18 +218,29 @@ void read_proc_mounts(struct mount_options *mo)
 	char save_opts[PATH_MAX];
 	char save_device[PATH_MAX];
 	int found = 0;
+	struct stat st_mo_dev, st_mounts_dev;
 
 	file = fopen("/proc/mounts", "r");
 	if (!file)
 		die("can't open /proc/mounts: %s\n", strerror(errno));
 
+	memset(&st_mo_dev, 0, sizeof(struct stat));
+	if (mo->dev[0]) {
+		if (stat(mo->dev, &st_mo_dev))
+			warn("Can't stat device %s.\n", mo->dev);
+	}
+
 	while (fgets(line, PATH_MAX, file)) {
 		if (sscanf(line, "%s %s %s %s", device, path, type, opts) != 4)
 			continue;
 		if (strcmp(path, mo->dir))
 			continue;
-		if (mo->dev[0] && strcmp(device, mo->dev))
-			continue;
+		if (mo->dev[0]) {
+			if (stat(device, &st_mounts_dev))
+				continue;
+			if (st_mo_dev.st_rdev != st_mounts_dev.st_rdev)
+				continue;
+		}
 		if (strcmp(type, fsname))
 			die("%s is not a %s filesystem\n", mo->dir, fsname);
 



More information about the Cluster-cvs mailing list