Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff... Commit: cbcad2164d2d04264f15e0e03c49790b6758fc4e Parent: 3381f38d309e7d6b30718b563044fad0ea5846f7 Author: Bob Peterson rpeterso@redhat.com AuthorDate: Mon Sep 13 12:21:32 2010 -0500 Committer: Bob Peterson rpeterso@redhat.com CommitterDate: Mon Sep 13 12:45:37 2010 -0500
Updating /proc/mounts and /etc/mtab with mount args for GFS2 fs
This patch changes the way the gfs2 mount helper, mount.gfs2, updates the /etc/mtab file. Before, it was copying the line from /proc/mounts directly into /etc/mtab after a successful mount. The problem is, that may be mapped to a different device by the device-mapper layer, which meant it did not match the device properly if a subsequent mount was done for the same device. This patch uses the device specified on the mount.gfs2 command line argument (which normally comes from the mount command), already translated properly as it expects for subsequent mount attempts.
rhbz#632595 --- gfs2/mount/mount.gfs2.c | 1 + gfs2/mount/mtab.c | 2 +- gfs2/mount/util.c | 4 ++-- gfs2/mount/util.h | 1 + 4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/gfs2/mount/mount.gfs2.c b/gfs2/mount/mount.gfs2.c index 610a7f8..ed9408b 100644 --- a/gfs2/mount/mount.gfs2.c +++ b/gfs2/mount/mount.gfs2.c @@ -88,6 +88,7 @@ static void read_options(int argc, char **argv, struct mount_options *mo) if (!real) die("invalid device path "%s"\n", argv[optind]); strncpy(mo->dev, real, PATH_MAX); + strncpy(mo->specified_dev, argv[optind], PATH_MAX); free(real); }
diff --git a/gfs2/mount/mtab.c b/gfs2/mount/mtab.c index 6db9785..148ff14 100644 --- a/gfs2/mount/mtab.c +++ b/gfs2/mount/mtab.c @@ -99,7 +99,7 @@ void add_mtab_entry(struct mount_options *mo) return; }
- fprintf(file, "%s", mo->proc_entry); + fprintf(file, "%s%s", mo->specified_dev, strchr(mo->proc_entry, ' '));
fclose(file);
diff --git a/gfs2/mount/util.c b/gfs2/mount/util.c index 891f475..33ba90f 100644 --- a/gfs2/mount/util.c +++ b/gfs2/mount/util.c @@ -211,7 +211,6 @@ static int mnt_unescape(char *dest, size_t len, const char *src) { unsigned i = 0, j = 0; size_t srclen; - int ret = -1;
srclen = strlen(src); while (i < srclen) { @@ -318,7 +317,8 @@ void read_proc_mounts(struct mount_options *mo) strncpy(mo->proc_entry, save_line, PATH_MAX); }
- log_debug("read_proc_mounts: device = "%s"", mo->dev); + log_debug("read_proc_mounts: device = "%s"", mo->specified_dev); + log_debug("read_proc_mounts: dm device = "%s"", mo->dev); log_debug("read_proc_mounts: opts = "%s"", mo->opts); }
diff --git a/gfs2/mount/util.h b/gfs2/mount/util.h index 7b856ac..e866cd4 100644 --- a/gfs2/mount/util.h +++ b/gfs2/mount/util.h @@ -46,6 +46,7 @@ do { \ } while (0)
struct mount_options { + char specified_dev[PATH_MAX+1]; char dev[PATH_MAX+1]; char dir[PATH_MAX+1]; char opts[PATH_MAX+1];
cluster-commits@lists.fedorahosted.org