Whamcloud - gitweb
LU-6978 utils: mkfs.lustre to recognise non ldiskfs opts 37/15937/3
authorAlexander Zarochentsev <alexander.zarochentsev@seagate.com>
Sun, 9 Aug 2015 20:50:04 +0000 (23:50 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 19 Sep 2015 03:18:38 +0000 (03:18 +0000)
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 <alexander.zarochentsev@seagate.com>
Reviewed-on: http://review.whamcloud.com/15937
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Andrew Perepechko <andrew.perepechko@seagate.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/doc/mkfs.lustre.8
lustre/doc/tunefs.lustre.8
lustre/utils/mkfs_lustre.c
lustre/utils/mount_utils.h
lustre/utils/mount_utils_ldiskfs.c

index a9a879f..6100656 100644 (file)
@@ -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
index 57da9a9..8e49b45 100644 (file)
@@ -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
index 7ee492b..76974e8 100644 (file)
@@ -137,7 +137,8 @@ void usage(FILE *out)
                "\t\t\trequired for all targets other than MGS\n"
                "\t\t--mgsnode=<nid>[,<...>]: NID(s) of remote MGS\n"
                "\t\t\trequired for all targets other than MGS\n"
-               "\t\t--mountfsoptions=<opts>: permanent mount options\n"
+               "\t\t--mountfsoptions=<opts>: permanent Lustre mount options\n"
+               "\t\t--backfs-mount-opts=<opts>: backing fs mount options\n"
                "\t\t--failnode=<nid>[,<...>]: NID(s) of backup failover node\n"
                "\t\t\tmutually exclusive with --servicenode\n"
                "\t\t--servicenode=<nid>[,<...>]: 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);
index 4fac57f..13180ed 100644 (file)
@@ -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;
index 6bc37a2..f36c280 100644 (file)
@@ -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));