* Recommended e2fsprogs version: 1.41.6.sun1
Severity : normal
+Bugzilla : 19689
+Description: Change tunefs.lustre and mkfs.lustre --mountfsoptions so that
+ exactly the specified mount options are used. Leaving off
+ any "mandatory" mount options is an error. Leaving off any
+ default mount options causes a warning, but is allowed.
+ Change errors=remount-ro from mandatory to default. Sanitize
+ the mount string before storing it. Update man pages accordingly.
+
+Severity : normal
Bugzilla : 20302
Description: mds_getattr() should return 0, even if mds_fid2entry() fails with
-ENOENT. Also fix in ptlrpc_expire_one_request() to print signed
Format options for the backing fs. For example, ext3 options could be set here.
.TP
.BI \--mountfsoptions= opts
-Set permanent mount options, equivalent to setting in /etc/fstab
+Set the mount options that will be used when mounting the backing 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.
+The defaults for \fIldiskfs\fR are
+OST: \fIerrors=remount-ro,mballoc,extents\fR;
+MGS/MDT: \fIerrors=remount-ro,iopen_nopriv,user_xattr\fR.
+\fBDO NOT\fR alter the default mount options unless you know what you are doing.
.TP
.BI \--mgsnode= nid,...
Set the NID(s) of the MGS node, required for all targets other than the MGS.
.SH SYNOPSIS
.br
.B tunefs.lustre
-[options]
+[options]
.I device
.br
.SH DESCRIPTION
.BI \--erase-params
Remove all previous parameter info
.TP
-.BI \--failnode= nid,...
+.BI \--failnode= nid,...
Set the NID(s) of a failover partner. This option can be repeated as desired.
.TP
-.BI \--fsname= filesystem_name
+.BI \--fsname= filesystem_name
The Lustre filesystem this service will be part of. Default is 'lustre'
.TP
.BI \--index= index
-Force a particular OST or MDT index
+Force a particular OST or MDT index
.TP
.BI \--mountfsoptions= opts
-Set permanent mount options, equivalent to setting in /etc/fstab
+Set the mount options that will be used when mounting the backing 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
+mount options are omitted. The defaults for ldiskfs are
+OST: \fIerrors=remount-ro,mballoc,extents\fR;
+MGS/MDT: \fIerrors=remount-ro,iopen_nopriv,user_xattr\fR.
+\fBDO NOT\fR alter the default mount options unless you know what you are doing.
.TP
.BI \--mgs
Add a configuration management service to this target
.TP
-.BI \--mgsnode= nid,...
+.BI \--mgsnode= nid,...
Set the NID(s) of the MGS node, required for all targets other than the MGS.
.TP
.BI \--nomgs
Erase all config logs for the filesystem that this MDT is part of, and
regenerate them. This is very dangerous. All clients and servers should
be stopped.
-All targets must then be restarted to regenerate the logs.
+All targets must then be restarted to regenerate the logs.
No clients should be started until all targets have restarted.
In general this should be executed on the MDT only, not the OSTs.
Add a failover NID location for this target
.TP
.B tunefs.lustre --mgs --mdt --fsname=testfs /dev/sda
-Upgrade an old 1.4.X Lustre MDT to 1.6. The new filesystem name is "testfs".
+Upgrade an old 1.4.X Lustre MDT to 1.6. The new filesystem name is "testfs".
.TP
.B tunefs.lustre --writeconf --mgs --mdt --fsname=testfs /dev/sda1
Upgrade an old 1.4.X Lustre MDT to 1.6, and start with brand-new 1.6
Please report all bugs to Sun Microsystems using http://bugzilla.lustre.org/
.SH AVAILABILITY
.B tunefs.lustre
-is part of the
-.BR Lustre (7)
+is part of the
+.BR Lustre (7)
filesystem package and is available from Sun Microsystems, Inc via
.br
http://downloads.lustre.org
MDSDEV=${MDSDEV:-$TMP/${FSNAME}-mdt}
MDSSIZE=${MDSSIZE:-400000}
-MDSOPT=${MDSOPT:-"--mountfsoptions=acl"}
+MDSOPT=${MDSOPT:-"--mountfsoptions=errors=remount-ro,iopen_nopriv,user_xattr,acl"}
mdsfailover_dev=${mdsfailover_dev:-$MDSDEV}
#include <string.h>
#include <getopt.h>
#include <limits.h>
+#include <ctype.h>
#ifdef __linux__
/* kp30.h is not really needed here, but on SLES10/PPC, fs.h includes idr.h which
return 0;
}
+/* Search for opt in mntlist, returning true if found.
+ */
+static int in_mntlist(char *opt, char *mntlist)
+{
+ char *ml, *mlp, *item, *ctx;
+
+ if (!(ml = strdup(mntlist))) {
+ fprintf(stderr, "%s: out of memory\n", progname);
+ exit(1);
+ }
+ mlp = ml;
+ while ((item = strtok_r(mlp, ",", &ctx))) {
+ if (!strcmp(opt, item))
+ break;
+ mlp = NULL;
+ }
+ free(ml);
+ return (item != NULL);
+}
+
+/* Issue a message on stderr for every item in wanted_mountopts that is not
+ * present in mountopts. The justwarn boolean toggles between error and
+ * warning message. Return an error count.
+ */
+static int check_mountfsoptions(char *mountopts, char *wanted_mountopts,
+ int justwarn)
+{
+ char *ml, *mlp, *item, *ctx;
+ int errors = 0;
+
+ if (!(ml = strdup(wanted_mountopts))) {
+ fprintf(stderr, "%s: out of memory\n", progname);
+ exit(1);
+ }
+ mlp = ml;
+ while ((item = strtok_r(mlp, ",", &ctx))) {
+ if (!in_mntlist(item, mountopts)) {
+ fprintf(stderr, "%s: %s mount option `%s' is missing\n",
+ progname, justwarn ? "Warning: default"
+ : "Error: mandatory", item);
+ errors++;
+ }
+ mlp = NULL;
+ }
+ free(ml);
+ return errors;
+}
+
+/* Trim embedded white space, leading and trailing commas from string s.
+ */
+static void trim_mountfsoptions(char *s)
+{
+ char *p;
+
+ for (p = s; *p; ) {
+ if (isspace(*p)) {
+ memmove(p, p + 1, strlen(p + 1) + 1);
+ continue;
+ }
+ p++;
+ }
+
+ while (s[0] == ',')
+ memmove(&s[0], &s[1], strlen(&s[1]) + 1);
+
+ p = s + strlen(s) - 1;
+ while (p >= s && *p == ',')
+ *p-- = '\0';
+}
+
int main(int argc, char *const argv[])
{
struct mkfs_opts mop;
case LDD_MT_EXT3:
case LDD_MT_LDISKFS:
case LDD_MT_LDISKFS2: {
- sprintf(always_mountopts, "errors=remount-ro");
+ strscat(default_mountopts, ",errors=remount-ro",
+ sizeof(default_mountopts));
if (IS_MDT(ldd) || IS_MGS(ldd))
strscat(always_mountopts, ",iopen_nopriv,user_xattr",
sizeof(always_mountopts));
}
case LDD_MT_SMFS: {
mop.mo_flags |= MO_IS_LOOP;
- sprintf(always_mountopts, "type=ext3,dev=%s",
+ sprintf(always_mountopts, ",type=ext3,dev=%s",
mop.mo_device);
break;
}
}
if (mountopts) {
- /* If user specifies mount opts, don't use defaults,
- but always use always_mountopts */
- sprintf(ldd->ldd_mount_opts, "%s,%s",
- always_mountopts, mountopts);
+ trim_mountfsoptions(mountopts);
+ (void)check_mountfsoptions(mountopts, default_mountopts, 1);
+ if (check_mountfsoptions(mountopts, always_mountopts, 0)) {
+ ret = EINVAL;
+ goto out;
+ }
+ sprintf(ldd->ldd_mount_opts, "%s", mountopts);
} else {
#ifdef TUNEFS
if (ldd->ldd_mount_opts[0] == 0)
{
sprintf(ldd->ldd_mount_opts, "%s%s",
always_mountopts, default_mountopts);
+ trim_mountfsoptions(ldd->ldd_mount_opts);
}
}