* [Cluster-devel] cluster/gfs2/mount mount.gfs2.c umount.gfs2.c
@ 2006-07-25 13:58 teigland
0 siblings, 0 replies; 4+ messages in thread
From: teigland @ 2006-07-25 13:58 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-07-25 13:58:17
Modified files:
gfs2/mount : mount.gfs2.c umount.gfs2.c
Log message:
From: fabbione at ubuntu.com
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.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/mount.gfs2.c.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/umount.gfs2.c.diff?cvsroot=cluster&r1=1.10&r2=1.11
--- cluster/gfs2/mount/mount.gfs2.c 2006/07/20 20:19:04 1.14
+++ cluster/gfs2/mount/mount.gfs2.c 2006/07/25 13:58:16 1.15
@@ -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,12 @@
++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);
}
--- cluster/gfs2/mount/umount.gfs2.c 2006/07/20 20:19:04 1.10
+++ cluster/gfs2/mount/umount.gfs2.c 2006/07/25 13:58:16 1.11
@@ -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,12 @@
}
}
- 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);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] cluster/gfs2/mount mount.gfs2.c umount.gfs2.c
@ 2006-07-28 13:58 rpeterso
0 siblings, 0 replies; 4+ messages in thread
From: rpeterso @ 2006-07-28 13:58 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rpeterso at sourceware.org 2006-07-28 13:58:10
Modified files:
gfs2/mount : mount.gfs2.c umount.gfs2.c
Log message:
1. Allow SIGINT signals so that gdb can break into hung mounts.
2. Remove multiple trailing slashes for directory and mount point.
3. Accept the -f option on umount that's sent to us during shutdown.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/mount.gfs2.c.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/umount.gfs2.c.diff?cvsroot=cluster&r1=1.11&r2=1.12
--- cluster/gfs2/mount/mount.gfs2.c 2006/07/25 13:58:16 1.15
+++ cluster/gfs2/mount/mount.gfs2.c 2006/07/28 13:58:10 1.16
@@ -30,6 +30,7 @@
sigfillset(&sigs);
sigdelset(&sigs, SIGTRAP);
sigdelset(&sigs, SIGSEGV);
+ sigdelset(&sigs, SIGINT);
sigprocmask(how, &sigs, (sigset_t *) 0);
}
@@ -83,9 +84,11 @@
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;
+ l = strlen(mo->dir) - 1;
+ while (l > 0 && mo->dir[l] == '/') {
+ mo->dir[l] = '\0';
+ l--;
+ };
}
log_debug("mount %s %s", mo->dev, mo->dir);
--- cluster/gfs2/mount/umount.gfs2.c 2006/07/25 13:58:16 1.11
+++ cluster/gfs2/mount/umount.gfs2.c 2006/07/28 13:58:10 1.12
@@ -37,13 +37,16 @@
/* FIXME: check for "quiet" option and don't print in that case */
while (cont) {
- optchar = getopt(argc, argv, "hVvX:");
+ optchar = getopt(argc, argv, "fhVvX:");
switch (optchar) {
case EOF:
cont = 0;
break;
+ case 'f': /* autofs umount from /sbin/halt uses this */
+ break;
+
case 'v':
++verbose;
break;
@@ -68,9 +71,11 @@
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;
+ l = strlen(mo->dir) - 1;
+ while (l > 0 && mo->dir[l] == '/') {
+ mo->dir[l] = '\0';
+ l--;
+ };
}
log_debug("umount %s", mo->dir);
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] cluster/gfs2/mount mount.gfs2.c umount.gfs2.c
@ 2007-06-13 18:12 teigland
0 siblings, 0 replies; 4+ messages in thread
From: teigland @ 2007-06-13 18:12 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2007-06-13 18:12:36
Modified files:
gfs2/mount : mount.gfs2.c umount.gfs2.c
Log message:
Block SIGINT (^C) around the three steps of mount:
joining the mountgroup, doing kernel mount, adding mtab entry.
And the same for doing the opposite in unmount.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/mount.gfs2.c.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/umount.gfs2.c.diff?cvsroot=cluster&r1=1.13&r2=1.14
--- cluster/gfs2/mount/mount.gfs2.c 2007/05/14 19:01:01 1.23
+++ cluster/gfs2/mount/mount.gfs2.c 2007/06/13 18:12:36 1.24
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
@@ -11,6 +11,7 @@
char *prog_name;
char *fsname;
int verbose;
+static sigset_t old_sigset;
static void print_version(void)
{
@@ -24,14 +25,18 @@
printf("This program is called by mount(8), it should not be used directly.\n");
}
-static void block_signals(int how)
+static void block_sigint(void)
{
- sigset_t sigs;
- sigfillset(&sigs);
- sigdelset(&sigs, SIGTRAP);
- sigdelset(&sigs, SIGSEGV);
- sigdelset(&sigs, SIGINT);
- sigprocmask(how, &sigs, (sigset_t *) 0);
+ sigset_t new;
+
+ sigemptyset(&new);
+ sigaddset(&new, SIGINT);
+ sigprocmask(SIG_BLOCK, &new, &old_sigset);
+}
+
+static void unblock_sigint(void)
+{
+ sigprocmask(SIG_SETMASK, &old_sigset, NULL);
}
static void read_options(int argc, char **argv, struct mount_options *mo)
@@ -203,12 +208,15 @@
proto = select_lockproto(&mo, &sb);
+ /* there are three parts to the mount and we want all three or none
+ to happen: joining the mountgroup, doing the kernel mount, and
+ adding the mtab entry */
+ block_sigint();
+
rv = mount_lockproto(proto, &mo, &sb);
if (rv < 0)
die("error mounting lockproto %s\n", proto);
- block_signals(SIG_BLOCK);
-
rv = mount(mo.dev, mo.dir, fsname, mo.flags, mo.extra_plus);
if (rv) {
log_debug("mount(2) failed error %d errno %d", rv, errno);
@@ -217,7 +225,6 @@
if (!(mo.flags & MS_REMOUNT))
umount_lockproto(proto, &mo, &sb, errno);
- block_signals(SIG_UNBLOCK);
if (errno == EBUSY)
die("%s already mounted or %s busy\n", mo.dev, mo.dir);
die("error %d mounting %s on %s\n", errno, mo.dev, mo.dir);
@@ -225,11 +232,11 @@
log_debug("mount(2) ok");
mount_result_lockproto(proto, &mo, &sb, 0);
- block_signals(SIG_UNBLOCK);
-
if (!(mo.flags & MS_REMOUNT))
add_mtab_entry(&mo);
+ unblock_sigint();
+
return rv ? 1 : 0;
}
--- cluster/gfs2/mount/umount.gfs2.c 2006/12/01 22:50:05 1.13
+++ cluster/gfs2/mount/umount.gfs2.c 2007/06/13 18:12:36 1.14
@@ -12,6 +12,7 @@
char *fsname;
char *expert;
int verbose;
+static sigset_t old_sigset;
static void print_version(void)
{
@@ -28,6 +29,20 @@
}
+static void block_sigint(void)
+{
+ sigset_t new;
+
+ sigemptyset(&new);
+ sigaddset(&new, SIGINT);
+ sigprocmask(SIG_BLOCK, &new, &old_sigset);
+}
+
+static void unblock_sigint(void)
+{
+ sigprocmask(SIG_SETMASK, &old_sigset, NULL);
+}
+
static void read_options(int argc, char **argv, struct mount_options *mo)
{
int cont = 1;
@@ -129,6 +144,8 @@
get_sb(mo.dev, &sb);
parse_opts(&mo);
+ block_sigint();
+
rv = umount(mo.dir);
if (rv) {
if (errno == EBUSY)
@@ -141,6 +158,8 @@
del_mtab_entry(&mo);
+ unblock_sigint();
+
return 0;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] cluster/gfs2/mount mount.gfs2.c umount.gfs2.c
@ 2007-06-13 18:13 teigland
0 siblings, 0 replies; 4+ messages in thread
From: teigland @ 2007-06-13 18:13 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: teigland at sourceware.org 2007-06-13 18:13:33
Modified files:
gfs2/mount : mount.gfs2.c umount.gfs2.c
Log message:
Block SIGINT (^C) around the three steps of mount:
joining the mountgroup, doing kernel mount, adding mtab entry.
And the same for doing the opposite in unmount.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/mount.gfs2.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.20.2.3&r2=1.20.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/umount.gfs2.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.12.2.1&r2=1.12.2.2
--- cluster/gfs2/mount/mount.gfs2.c 2007/05/14 19:08:43 1.20.2.3
+++ cluster/gfs2/mount/mount.gfs2.c 2007/06/13 18:13:33 1.20.2.4
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
@@ -11,6 +11,7 @@
char *prog_name;
char *fsname;
int verbose;
+static sigset_t old_sigset;
static void print_version(void)
{
@@ -24,14 +25,18 @@
printf("This program is called by mount(8), it should not be used directly.\n");
}
-static void block_signals(int how)
+static void block_sigint(void)
{
- sigset_t sigs;
- sigfillset(&sigs);
- sigdelset(&sigs, SIGTRAP);
- sigdelset(&sigs, SIGSEGV);
- sigdelset(&sigs, SIGINT);
- sigprocmask(how, &sigs, (sigset_t *) 0);
+ sigset_t new;
+
+ sigemptyset(&new);
+ sigaddset(&new, SIGINT);
+ sigprocmask(SIG_BLOCK, &new, &old_sigset);
+}
+
+static void unblock_sigint(void)
+{
+ sigprocmask(SIG_SETMASK, &old_sigset, NULL);
}
static void read_options(int argc, char **argv, struct mount_options *mo)
@@ -203,12 +208,15 @@
proto = select_lockproto(&mo, &sb);
+ /* there are three parts to the mount and we want all three or none
+ to happen: joining the mountgroup, doing the kernel mount, and
+ adding the mtab entry */
+ block_sigint();
+
rv = mount_lockproto(proto, &mo, &sb);
if (rv < 0)
die("error mounting lockproto %s\n", proto);
- block_signals(SIG_BLOCK);
-
rv = mount(mo.dev, mo.dir, fsname, mo.flags, mo.extra_plus);
if (rv) {
log_debug("mount(2) failed error %d errno %d", rv, errno);
@@ -217,7 +225,6 @@
if (!(mo.flags & MS_REMOUNT))
umount_lockproto(proto, &mo, &sb, errno);
- block_signals(SIG_UNBLOCK);
if (errno == EBUSY)
die("%s already mounted or %s busy\n", mo.dev, mo.dir);
die("error %d mounting %s on %s\n", errno, mo.dev, mo.dir);
@@ -225,11 +232,11 @@
log_debug("mount(2) ok");
mount_result_lockproto(proto, &mo, &sb, 0);
- block_signals(SIG_UNBLOCK);
-
if (!(mo.flags & MS_REMOUNT))
add_mtab_entry(&mo);
+ unblock_sigint();
+
return rv ? 1 : 0;
}
--- cluster/gfs2/mount/umount.gfs2.c 2006/12/01 22:50:58 1.12.2.1
+++ cluster/gfs2/mount/umount.gfs2.c 2007/06/13 18:13:33 1.12.2.2
@@ -12,6 +12,7 @@
char *fsname;
char *expert;
int verbose;
+static sigset_t old_sigset;
static void print_version(void)
{
@@ -28,6 +29,20 @@
}
+static void block_sigint(void)
+{
+ sigset_t new;
+
+ sigemptyset(&new);
+ sigaddset(&new, SIGINT);
+ sigprocmask(SIG_BLOCK, &new, &old_sigset);
+}
+
+static void unblock_sigint(void)
+{
+ sigprocmask(SIG_SETMASK, &old_sigset, NULL);
+}
+
static void read_options(int argc, char **argv, struct mount_options *mo)
{
int cont = 1;
@@ -129,6 +144,8 @@
get_sb(mo.dev, &sb);
parse_opts(&mo);
+ block_sigint();
+
rv = umount(mo.dir);
if (rv) {
if (errno == EBUSY)
@@ -141,6 +158,8 @@
del_mtab_entry(&mo);
+ unblock_sigint();
+
return 0;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-06-13 18:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-13 18:13 [Cluster-devel] cluster/gfs2/mount mount.gfs2.c umount.gfs2.c teigland
-- strict thread matches above, loose matches on Subject: below --
2007-06-13 18:12 teigland
2006-07-28 13:58 rpeterso
2006-07-25 13:58 teigland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).