[Cluster-devel] [PATCH 001/003] fix: gfs2 mount umount
Fabio M. Di Nitto
fabbione at ubuntu.com
Tue Jul 25 08:19:05 UTC 2006
This one was a nasty bug that was causing several issues.
For example:
mount -t gfs /dev/foo /mnt -> ok
mount -t gfs /dev/foo /mnt/ -> nok failing with:
can't find /proc/mounts entry for directory /mnt/
(caused by read_proc_mounts in util.c when comparing with /proc/mounts
that does not reference the trailing /).
Other bugs are also fixed by making mo->dir consistent.
mount -t gfs /dev/foo /mnt -> ok
umount /mnt/ -> nok:
/sbin/umount.gfs: lock_dlm_leave: gfs_controld leave error: -1
because the mo->dir is also registered in lock_dlm daemon.
This was causing a severe inconsistence that was blocking mounting/umounting
or other volumes/devices.
diff -urNad redhat-cluster-suite-2.20060716~/gfs2/mount/mount.gfs2.c redhat-cluster-suite-2.20060716/gfs2/mount/mount.gfs2.c
--- redhat-cluster-suite-2.20060716~/gfs2/mount/mount.gfs2.c 2006-07-25 08:53:33.000000000 +0200
+++ redhat-cluster-suite-2.20060716/gfs2/mount/mount.gfs2.c 2006-07-25 08:53:35.000000000 +0200
@@ -37,6 +37,7 @@
{
int cont = 1;
int optchar;
+ int l;
/* FIXME: check for "quiet" option and don't print in that case */
@@ -80,8 +81,13 @@
++optind;
- if (optind < argc && argv[optind])
+ if (optind < argc && argv[optind]) {
strncpy(mo->dir, argv[optind], PATH_MAX);
+ l = strlen(mo->dir);
+ if (mo->dir[l-1] == '/') {
+ mo->dir[l-1] = 0;
+ }
+ }
log_debug("mount %s %s", mo->dev, mo->dir);
}
diff -urNad redhat-cluster-suite-2.20060716~/gfs2/mount/umount.gfs2.c redhat-cluster-suite-2.20060716/gfs2/mount/umount.gfs2.c
--- redhat-cluster-suite-2.20060716~/gfs2/mount/umount.gfs2.c 2006-07-25 08:53:33.000000000 +0200
+++ redhat-cluster-suite-2.20060716/gfs2/mount/umount.gfs2.c 2006-07-25 08:53:46.000000000 +0200
@@ -32,6 +32,7 @@
{
int cont = 1;
int optchar;
+ int l;
/* FIXME: check for "quiet" option and don't print in that case */
@@ -65,8 +66,13 @@
}
}
- if (optind < argc && argv[optind])
+ if (optind < argc && argv[optind]) {
strncpy(mo->dir, argv[optind], PATH_MAX);
+ l = strlen(mo->dir);
+ if (mo->dir[l-1] == '/') {
+ mo->dir[l-1] = 0;
+ }
+ }
log_debug("umount %s", mo->dir);
}
More information about the Cluster-devel
mailing list