[Ocfs2-tools-devel] [PATCH 1/1] Mount.ocfs2: Append heartbeat mount option string only if it is not present on mo.xtra_opts
jeff.liu
jeff.liu at oracle.com
Sun Mar 14 23:31:32 PDT 2010
Hi Sunil,
Sunil Mushran wrote:
> We should just disallow users from providing that mount option.
> It is not a user option.
>
> Look at this.
> /dev/sdf1 on /ocfs2 type ocfs2 (rw,_netdev,heartbeat=none,heartbeat=local)
>
> Just bail upfront if the user provides "heartbeat=" in the extra options.
>
It looks the extra options only handle the command line options(-o xxx), user can specify this
option at /etc/fstab to bypass the extra_opts checking.
IMHO, we need to check the mo.opts in this case.
Could you check the revised patch below?
>From 56f92721cd793b59450be0cc3f34efbbcb8be9b6 Mon Sep 17 00:00:00 2001
From: Jeff Liu <jeff.liu at oracle.com>
Date: Mon, 15 Mar 2010 14:24:49 +0800
Subject: [PATCH 1/1] Mount.ocfs2: disallow heartbeat=xxxx as user mount option
The heartbeat=xxxx will present twice at /etc/mtab if the user specified heartbeat mount
option via mount or /etc/fstab, this patch fix it by pre-checking the options.
Signed-off-by: Jeff Liu <jeff.liu at oracle.com>
---
mount.ocfs2/mount.ocfs2.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/mount.ocfs2/mount.ocfs2.c b/mount.ocfs2/mount.ocfs2.c
index f820a30..f92c769 100644
--- a/mount.ocfs2/mount.ocfs2.c
+++ b/mount.ocfs2/mount.ocfs2.c
@@ -189,8 +189,14 @@ static int process_options(struct mount_options *mo)
return -1;
}
- if (mo->opts)
+ if (mo->opts) {
+ if (strstr(mo->opts, "heartbeat=")) {
+ com_err(progname, OCFS2_ET_INVALID_ARGUMENT,
+ "\"hearbeat\" is not an option for user");
+ return -1;
+ }
parse_opts(mo->opts, &mo->flags, &mo->xtra_opts);
+ }
return 0;
}
--
1.5.4.3
More information about the Ocfs2-tools-devel
mailing list