cluster: STABLE3 - Fix device name and mount point in utils

Bob Peterson rpeterso at fedoraproject.org
Fri May 28 14:43:34 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=e724bb5fe6abc7395c525b2bf483810577b92c33
Commit:        e724bb5fe6abc7395c525b2bf483810577b92c33
Parent:        cc64807655a955c7eaa460d6e3707c051a773305
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Fri May 28 08:28:46 2010 -0500
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Fri May 28 08:39:01 2010 -0500

Fix device name and mount point in utils

This patch fixes a regression introduced by commit 04f7da3 whereby
the gfs2-utils identified whether a gfs2 file system was mounted.
The method works fine when specifying the mount point for tools like
gfs2_grow.  However, it doesn't work when the device is specified.
The solution is to copy the discovered device name and mount point
into the proper libgfs2 variables used by the utils.

rhbz#597002
---
 gfs2/libgfs2/misc.c |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index 8981114..31fc665 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -113,9 +113,7 @@ int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount)
 	}
 	if (stat(sdp->path_name, &st_buf) == 0) {
 		if (S_ISBLK(st_buf.st_mode)) {
-#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
 			file_rdev = st_buf.st_rdev;
-#endif  /* __GNU__ */
 		} else {
 			file_dev = st_buf.st_dev;
 			file_ino = st_buf.st_ino;
@@ -131,16 +129,21 @@ int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount)
 			strcpy(sdp->device_name, mnt->mnt_fsname); /* fix it */
 			break;
 		}
-		if (stat(mnt->mnt_fsname, &st_buf) == 0) {
-			if (S_ISBLK(st_buf.st_mode)) {
-#ifndef __GNU__
-				if (file_rdev && (file_rdev == st_buf.st_rdev))
-					break;
-#endif  /* __GNU__ */
-			} else {
-				if (file_dev && ((file_dev == st_buf.st_dev) &&
-						 (file_ino == st_buf.st_ino)))
-					break;
+		if (stat(mnt->mnt_fsname, &st_buf) != 0)
+			continue;
+
+		if (S_ISBLK(st_buf.st_mode)) {
+			if (file_rdev && (file_rdev == st_buf.st_rdev)) {
+				strcpy(sdp->device_name, mnt->mnt_fsname);
+				strcpy(sdp->path_name, mnt->mnt_dir);
+				break;
+			}
+		} else {
+			if (file_dev && ((file_dev == st_buf.st_dev) &&
+					 (file_ino == st_buf.st_ino))) {
+				strcpy(sdp->device_name, mnt->mnt_fsname);
+				strcpy(sdp->path_name, mnt->mnt_dir);
+				break;
 			}
 		}
 	}


More information about the cluster-commits mailing list