cluster: RHEL56 - unmount GFS2 filesystem fail when other filesystems are mounted

Bob Peterson rpeterso at fedoraproject.org
Fri Sep 17 21:54:58 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=53dba11a565ed574c6433ed8ba8c12c274185911
Commit:        53dba11a565ed574c6433ed8ba8c12c274185911
Parent:        f4e6157cb9822895a1372cc02c4e793091a87c6c
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Fri Sep 17 15:49:49 2010 -0500
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Fri Sep 17 16:56:25 2010 -0500

unmount GFS2 filesystem fail when other filesystems are mounted

The code that parses /proc/mounts was stopping as soon as it
found the mount point in question, ignoring the fact that another
file system might be mounted there, prior in the list.  This
patch makes it go through the entire list until it finds the
proper one.

rhbz#627723
---
 gfs2/mount/util.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gfs2/mount/util.c b/gfs2/mount/util.c
index 2970d33..0213e42 100644
--- a/gfs2/mount/util.c
+++ b/gfs2/mount/util.c
@@ -186,7 +186,7 @@ void read_proc_mounts(struct mount_options *mo)
 	char save_line[PATH_MAX];
 	char save_opts[PATH_MAX];
 	char save_device[PATH_MAX];
-	int found = 0;
+	int found = 0, is_correct_type = 0;
 	struct stat st_mo_dev, st_mounts_dev;
 
 	file = fopen("/proc/mounts", "r");
@@ -210,8 +210,9 @@ void read_proc_mounts(struct mount_options *mo)
 			if (st_mo_dev.st_rdev != st_mounts_dev.st_rdev)
 				continue;
 		}
+		found = 1;
 		if (strcmp(type, fsname))
-			die("%s is not a %s filesystem\n", mo->dir, fsname);
+			continue;
 
 		/* when there is an input dev specified (mount), we should get
 		   only one matching line; when there is no input dev specified
@@ -220,11 +221,14 @@ void read_proc_mounts(struct mount_options *mo)
 		strncpy(save_device, device, PATH_MAX);
 		strncpy(save_opts, opts, PATH_MAX);
 		strncpy(save_line, line, PATH_MAX);
-		found = 1;
+		is_correct_type = 1;
 	}
 
 	fclose(file);
 
+	if (found && !is_correct_type)
+		die("%s is not a %s filesystem\n", mo->dir, fsname);
+
 	if (!found)
 		die("can't find /proc/mounts entry for directory %s\n", mo->dir);
 	else {


More information about the cluster-commits mailing list