* [Cluster-devel] [PATCH] mount.gfs2 - gfs2 mounts doubled up in mtab
[not found] <201524563.167642.1311192642732.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
@ 2011-07-20 20:10 ` Abhijith Das
2011-07-22 8:35 ` Steven Whitehouse
0 siblings, 1 reply; 3+ messages in thread
From: Abhijith Das @ 2011-07-20 20:10 UTC (permalink / raw)
To: cluster-devel.redhat.com
When the -o remount option is used with mount.gfs2 it fails to remove the original mtab entry because it can't find it. Instead it simply adds the mount entry corresponding to the remount, thereby doubling the entries in mtab. This patch corrects the logic to find the mtab entry so mount.gfs2 finds and removes the original entry correctly before add the the remount entry.
Signed-off-by: Abhi Das <adas@redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bz706141-upstream.patch
Type: text/x-patch
Size: 1143 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20110720/c485d19c/attachment.bin>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH] mount.gfs2 - gfs2 mounts doubled up in mtab
2011-07-20 20:10 ` [Cluster-devel] [PATCH] mount.gfs2 - gfs2 mounts doubled up in mtab Abhijith Das
@ 2011-07-22 8:35 ` Steven Whitehouse
2011-07-22 14:11 ` Abhijith Das
0 siblings, 1 reply; 3+ messages in thread
From: Steven Whitehouse @ 2011-07-22 8:35 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
On Wed, 2011-07-20 at 16:10 -0400, Abhijith Das wrote:
> When the -o remount option is used with mount.gfs2 it fails to remove the original mtab entry because it can't find it. Instead it simply adds the mount entry corresponding to the remount, thereby doubling the entries in mtab. This patch corrects the logic to find the mtab entry so mount.gfs2 finds and removes the original entry correctly before add the the remount entry.
>
> Signed-off-by: Abhi Das <adas@redhat.com>
+ sscanf(line, "%s %s %s", device, path, type);
This seems to remove the error checking for argument assignment from
sscanf,
Steve.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH] mount.gfs2 - gfs2 mounts doubled up in mtab
2011-07-22 8:35 ` Steven Whitehouse
@ 2011-07-22 14:11 ` Abhijith Das
0 siblings, 0 replies; 3+ messages in thread
From: Abhijith Das @ 2011-07-22 14:11 UTC (permalink / raw)
To: cluster-devel.redhat.com
----- Original Message -----
> From: "Steven Whitehouse" <swhiteho@redhat.com>
> To: "Abhijith Das" <adas@redhat.com>
> Cc: "cluster-devel" <cluster-devel@redhat.com>
> Sent: Friday, July 22, 2011 3:35:53 AM
> Subject: Re: [Cluster-devel] [PATCH] mount.gfs2 - gfs2 mounts doubled up in mtab
> Hi,
>
> On Wed, 2011-07-20 at 16:10 -0400, Abhijith Das wrote:
> > When the -o remount option is used with mount.gfs2 it fails to
> > remove the original mtab entry because it can't find it. Instead it
> > simply adds the mount entry corresponding to the remount, thereby
> > doubling the entries in mtab. This patch corrects the logic to find
> > the mtab entry so mount.gfs2 finds and removes the original entry
> > correctly before add the the remount entry.
> >
> > Signed-off-by: Abhi Das <adas@redhat.com>
>
> + sscanf(line, "%s %s %s", device, path, type);
>
> This seems to remove the error checking for argument assignment from
> sscanf,
>
> Steve.
Hi,
This was fixed before checking into gfs2-utils.git and cluster.git. Here's the patch that actually went in:
Thanks!
--Abhi
Red Hat Filesystems
diff --git a/gfs2/mount/mtab.c b/gfs2/mount/mtab.c
index 148ff14..fbe5f63 100644
--- a/gfs2/mount/mtab.c
+++ b/gfs2/mount/mtab.c
@@ -120,6 +120,7 @@ void del_mtab_entry(struct mount_options *mo)
mode_t old_umask;
struct stat sbuf;
int found = 0;
+ char *abs_path, *abs_dev;
if (ignore_mtab())
return;
@@ -139,13 +140,19 @@ void del_mtab_entry(struct mount_options *mo)
while (fgets(line, PATH_MAX, mtab)) {
/* exclude the line matching the fs being unmounted
from the next version of mtab */
-
- if ((sscanf(line, "%s %s %s", device, path, type) == 3) &&
- (strncmp(type, "gfs", 3) == 0) &&
- (strcmp(path, mo->dir) == 0) &&
- (strcmp(device, mo->dev) == 0)) {
- found = 1;
- continue;
+ if (sscanf(line, "%s %s %s", device, path, type) == 3) {
+ abs_path = realpath(path, NULL);
+ abs_dev = realpath(device, NULL);
+ if ((strcmp(type, "gfs2") == 0) &&
+ (strcmp(abs_path, mo->dir) == 0) &&
+ (strcmp(abs_dev, mo->dev) == 0)) {
+ found = 1;
+ free(abs_path);
+ free(abs_dev);
+ continue;
+ }
+ free(abs_path);
+ free(abs_dev);
}
/* all other lines from mtab are included in
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-22 14:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <201524563.167642.1311192642732.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2011-07-20 20:10 ` [Cluster-devel] [PATCH] mount.gfs2 - gfs2 mounts doubled up in mtab Abhijith Das
2011-07-22 8:35 ` Steven Whitehouse
2011-07-22 14:11 ` Abhijith Das
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).