From 1d1e001d6cddc3890d8315636a7a8eb4fdecd932 Mon Sep 17 00:00:00 2001 From: Alexander Zarochentsev Date: Sun, 9 Aug 2015 23:50:04 +0300 Subject: [PATCH] LU-6978 utils: mkfs.lustre to recognise non ldiskfs opts After "LU-6030 osd-ldiskfs: improve mount option handling landing", mkfs.lustre lost ability to store non ldiskfs persistent options, because their support was stripped out from ldiskfs layer. This patch makes ldiskfs mount independent from the mount options from mkfs.lustre command string. Change-Id: I63e2efb84249eae8294ce33a72894aeb52563ad5 Xyratex-bug-id: MRP-2819 Signed-off-by: Alexander Zarochentsev Reviewed-on: http://review.whamcloud.com/15937 Reviewed-by: Alex Zhuravlev Tested-by: Jenkins Reviewed-by: Andreas Dilger Reviewed-by: Yang Sheng Reviewed-by: Andrew Perepechko Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/doc/mkfs.lustre.8 | 5 ++++- lustre/doc/tunefs.lustre.8 | 5 ++++- lustre/utils/mkfs_lustre.c | 7 ++++++- lustre/utils/mount_utils.h | 1 + lustre/utils/mount_utils_ldiskfs.c | 3 ++- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lustre/doc/mkfs.lustre.8 b/lustre/doc/mkfs.lustre.8 index a9a879f..6100656 100644 --- a/lustre/doc/mkfs.lustre.8 +++ b/lustre/doc/mkfs.lustre.8 @@ -86,7 +86,7 @@ Specify a particular OST or MDT index. Required for all targets other than the M Format options for the backing fs. For example, ext3 options could be set here. .TP .BI \--mountfsoptions= opts -Set the mount options that will be used when mounting the backing fs. +Set the persistent mount options that will be used when mounting Lustre fs. WARNING: unlike earlier versions of \fBmkfs.lustre\fR, this version completely replaces the default mount options with those specified on the command line, issuing a warning on stderr if any of the default mount options are omitted. @@ -95,6 +95,9 @@ OST: \fIerrors=remount-ro,mballoc,extents\fR; MGS/MDT: \fIerrors=remount-ro,user_xattr\fR. \fBDO NOT\fR alter the default mount options unless you know what you are doing. .TP +.BI \--backfs-mount-opts=opts +Use these options for mounting backing fs while mkfs.lustre is working. +.TP .BI \--network= net,... Network(s) to restrict this ost/mdt to. This option can be repeated as desired. .TP diff --git a/lustre/doc/tunefs.lustre.8 b/lustre/doc/tunefs.lustre.8 index 57da9a9..8e49b45 100644 --- a/lustre/doc/tunefs.lustre.8 +++ b/lustre/doc/tunefs.lustre.8 @@ -51,7 +51,7 @@ The Lustre filesystem this service will be part of. Default is 'lustre' Force a particular OST or MDT index .TP .BI \--mountfsoptions= opts -Set the mount options that will be used when mounting the backing fs. +Set the persistent mount options that will be used when Lustre fs. WARNING: unlike earlier versions of \fBtunefs.lustre\fR, this version completely replaces the existing mount options with those specified on the command line, issuing a warning on stderr if any of the default @@ -60,6 +60,9 @@ OST: \fIerrors=remount-ro,mballoc,extents\fR; MGS/MDT: \fIerrors=remount-ro,user_xattr\fR. \fBDO NOT\fR alter the default mount options unless you know what you are doing. .TP +.BI \--backfs-mount-opts=opts +Use these options for mounting backing fs while tune.lustre is working. +.TP .BI \--network= net,... Network(s) to restrict this ost/mdt to. This option can be repeated as desired. .TP diff --git a/lustre/utils/mkfs_lustre.c b/lustre/utils/mkfs_lustre.c index 7ee492b..76974e8 100644 --- a/lustre/utils/mkfs_lustre.c +++ b/lustre/utils/mkfs_lustre.c @@ -137,7 +137,8 @@ void usage(FILE *out) "\t\t\trequired for all targets other than MGS\n" "\t\t--mgsnode=[,<...>]: NID(s) of remote MGS\n" "\t\t\trequired for all targets other than MGS\n" - "\t\t--mountfsoptions=: permanent mount options\n" + "\t\t--mountfsoptions=: permanent Lustre mount options\n" + "\t\t--backfs-mount-opts=: backing fs mount options\n" "\t\t--failnode=[,<...>]: NID(s) of backup failover node\n" "\t\t\tmutually exclusive with --servicenode\n" "\t\t--servicenode=[,<...>]: NID(s) of service partners\n" @@ -278,6 +279,7 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop, { static struct option long_opt[] = { { "backfstype", required_argument, NULL, 'b' }, + { "backfs-mount-opts", required_argument, NULL, 'B' }, { "stripe-count-hint", required_argument, NULL, 'c' }, { "comment", required_argument, NULL, 'u' }, { "configdev", required_argument, NULL, 'C' }, @@ -338,6 +340,9 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop, } break; } + case 'B': + mop->mo_mountopts = optarg; + break; case 'c': if (IS_MDT(&mop->mo_ldd)) { int stripe_count = atol(optarg); diff --git a/lustre/utils/mount_utils.h b/lustre/utils/mount_utils.h index 4fac57f..13180ed 100644 --- a/lustre/utils/mount_utils.h +++ b/lustre/utils/mount_utils.h @@ -75,6 +75,7 @@ struct mkfs_opts { char **mo_pool_vdevs; /* list of pool vdevs */ char mo_loopdev[128]; /* in case a loop dev is needed */ char mo_mkfsopts[512]; /* options to the backing-store mkfs */ + char *mo_mountopts; /* mount options for backing fs */ __u64 mo_device_kb; /* in KB */ int mo_stripe_count; int mo_flags; diff --git a/lustre/utils/mount_utils_ldiskfs.c b/lustre/utils/mount_utils_ldiskfs.c index 6bc37a21..f36c280 100644 --- a/lustre/utils/mount_utils_ldiskfs.c +++ b/lustre/utils/mount_utils_ldiskfs.c @@ -262,7 +262,8 @@ int ldiskfs_write_ldd(struct mkfs_opts *mop) dev = mop->mo_loopdev; ret = mount(dev, mntpt, MT_STR(&mop->mo_ldd), 0, - mop->mo_ldd.ldd_mount_opts); + (mop->mo_mountopts == NULL) ? + "errors=remount-ro" : mop->mo_mountopts); if (ret) { fprintf(stderr, "%s: Unable to mount %s: %s\n", progname, dev, strerror(errno)); -- 1.8.3.1