Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 9383e745e23602bc45f9c92184feea59 > files > 121

gfs2-utils-0.1.62-28.el5.src.rpm

commit 53dba11a565ed574c6433ed8ba8c12c274185911
Author: Bob Peterson <rpeterso@redhat.com>
Date:   Fri Sep 17 15:49:49 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

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 {