From: teigland@sourceware.org <teigland@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/gfs2/mount mtab.c util.c
Date: 2 Jan 2007 20:49:26 -0000 [thread overview]
Message-ID: <20070102204926.4161.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL50
Changes by: teigland at sourceware.org 2007-01-02 20:49:26
Modified files:
gfs2/mount : mtab.c util.c
Log message:
mount/umount modifications of /etc/mtab weren't smart enough
to get straight two different fs's mounted on the same mountpoint
bz 218560
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/mtab.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.3&r2=1.3.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/util.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.18.4.2&r2=1.18.4.3
--- cluster/gfs2/mount/mtab.c 2005/11/10 20:37:18 1.3
+++ cluster/gfs2/mount/mtab.c 2007/01/02 20:49:26 1.3.4.1
@@ -143,7 +143,8 @@
if ((sscanf(line, "%s %s %s", device, path, type) == 3) &&
(strncmp(type, "gfs", 3) == 0) &&
- (strcmp(path, mo->dir) == 0)) {
+ (strcmp(path, mo->dir) == 0) &&
+ (strcmp(device, mo->dev) == 0)) {
found = 1;
continue;
}
--- cluster/gfs2/mount/util.c 2006/12/20 19:16:49 1.18.4.2
+++ cluster/gfs2/mount/util.c 2007/01/02 20:49:26 1.18.4.3
@@ -157,6 +157,12 @@
log_debug("parse_opts: locktable = \"%s\"", mo->locktable);
}
+/* - when unmounting, we don't know the dev and need this function to set it;
+ we also want to select the _last_ line with a matching dir since it will
+ be the top-most fs that the umount(2) will unmount
+ - when mounting, we do know the dev and need this function to use it in the
+ comparison (for multiple fs's with the same mountpoint) */
+
void read_proc_mounts(struct mount_options *mo)
{
FILE *file;
@@ -165,6 +171,9 @@
char type[PATH_MAX];
char opts[PATH_MAX];
char device[PATH_MAX];
+ char save_line[PATH_MAX];
+ char save_opts[PATH_MAX];
+ char save_device[PATH_MAX];
int found = 0;
file = fopen("/proc/mounts", "r");
@@ -176,20 +185,31 @@
continue;
if (strcmp(path, mo->dir))
continue;
+ if (mo->dev[0] && strcmp(device, mo->dev))
+ continue;
if (strcmp(type, fsname))
die("%s is not a %s filesystem\n", mo->dir, fsname);
- strncpy(mo->dev, device, PATH_MAX);
- strncpy(mo->opts, opts, PATH_MAX);
- strncpy(mo->proc_entry, line, PATH_MAX);
+ /* when there is an input dev specified (mount), we should get
+ only one matching line; when there is no input dev specified
+ (umount), we want the _last_ matching line */
+
+ strncpy(save_device, device, PATH_MAX);
+ strncpy(save_opts, opts, PATH_MAX);
+ strncpy(save_line, line, PATH_MAX);
found = 1;
- break;
}
fclose(file);
if (!found)
die("can't find /proc/mounts entry for directory %s\n", mo->dir);
+ else {
+ strncpy(mo->dev, save_device, PATH_MAX);
+ strncpy(mo->opts, save_opts, PATH_MAX);
+ strncpy(mo->proc_entry, save_line, PATH_MAX);
+ }
+
log_debug("read_proc_mounts: device = \"%s\"", mo->dev);
log_debug("read_proc_mounts: opts = \"%s\"", mo->opts);
}
next reply other threads:[~2007-01-02 20:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-02 20:49 teigland [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-01-02 20:18 [Cluster-devel] cluster/gfs2/mount mtab.c util.c teigland
2007-01-02 20:18 teigland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070102204926.4161.qmail@sourceware.org \
--to=teigland@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.