[Ocfs2-tools-devel] [PATCH 1/1] Mount.ocfs2: Append heartbeat mount option string only if it is not present on mo.xtra_opts
Sunil Mushran
sunil.mushran at oracle.com
Fri Mar 12 09:48:59 PST 2010
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.
Sunil
Jeff Liu wrote:
> 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-check the extra_option_string whether it
> was already there or not.
>
> Signed-off-by: Jie Liu <jeff.liu at oracle.com>
> ---
> mount.ocfs2/mount.ocfs2.c | 10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/mount.ocfs2/mount.ocfs2.c b/mount.ocfs2/mount.ocfs2.c
> index f820a30..5ed1638 100644
> --- a/mount.ocfs2/mount.ocfs2.c
> +++ b/mount.ocfs2/mount.ocfs2.c
> @@ -367,9 +367,13 @@ int main(int argc, char **argv)
> hbstr = OCFS2_HB_LOCAL;
>
> if (mo.xtra_opts && *mo.xtra_opts) {
> - extra = xstrndup(mo.xtra_opts,
> - strlen(mo.xtra_opts) + strlen(hbstr) + 1);
> - extra = xstrconcat3(extra, ",", hbstr);
> + if (!strstr(mo.xtra_opts, hbstr)) {
> + extra = xstrndup(mo.xtra_opts,
> + strlen(mo.xtra_opts) + strlen(hbstr)
> + + 1);
> + extra = xstrconcat3(extra, ",", hbstr);
> + } else
> + extra = xstrndup(mo.xtra_opts, strlen(mo.xtra_opts));
> } else
> extra = xstrndup(hbstr, strlen(hbstr));
>
More information about the Ocfs2-tools-devel
mailing list