If the server filesystem is mounted with "-t lustre" use that type
for mounting instead of automatically selecting "lustre_tgt" for
server mounts, so that it is appearing in /proc/mounts correctly,
and "mount -t lustre" will list all of these filesystems.
Only if "mount -t lustre_tgt" is used will mount.lustre_tgt be called,
and that will internally use "lustre_tgt" as the filesystem type, and
only fall back to type "lustre" if that does not work. This will give
userspace plenty of time to transition to using "lustre_tgt" for
server mountpoints.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ifd7560c800acdfe14c9564bbf955ecad1224f2e3
Reviewed-on: https://review.whamcloud.com/40474
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
#endif /* HAVE_GSS */
if (!mop.mo_fake) {
#endif /* HAVE_GSS */
if (!mop.mo_fake) {
- char *fstype = client ? "lustre" : "lustre_tgt";
+ /* Prefer filesystem type given on mount command line
+ * so it appears correctly in the /proc/mounts output.
+ */
+ if (strstr(argv[0], "mount.lustre_tgt"))
+ fstype = "lustre_tgt";
+ else
+ fstype = "lustre";
/*
* flags and target get to lustre_get_sb(), but not
* lustre_fill_super(). Lustre ignores the flags, but mount
/*
* flags and target get to lustre_get_sb(), but not
* lustre_fill_super(). Lustre ignores the flags, but mount
rc = mount(mop.mo_source, mop.mo_target, fstype,
flags, (void *)options);
if (rc != 0) {
rc = mount(mop.mo_source, mop.mo_target, fstype,
flags, (void *)options);
if (rc != 0) {
- /* Older Lustre without 'lustre_tgt'.
- * Try 'lustre' instead
- */
- if (rc == -ENODEV) {
- fstype = "lustre";
- i--;
- continue;
- }
-
if (verbose) {
fprintf(stderr,
if (verbose) {
fprintf(stderr,
- "%s: mount %s at %s failed: %s retries left: %d\n",
- basename(progname),
+ "%s: mount -t %s %s at %s failed: %s retries left: %d\n",
+ basename(progname), fstype,
mop.mo_usource, mop.mo_target,
strerror(errno),
mop.mo_retry - i);
}
mop.mo_usource, mop.mo_target,
strerror(errno),
mop.mo_retry - i);
}
+ /* Pre-2.13 Lustre without 'lustre_tgt' type?
+ * Try with 'lustre' instead. Eventually this
+ * can be removed (e.g. 2.18 or whenever).
+ */
+ if (rc == -ENODEV &&
+ strcmp(fstype, "lustre_tgt") == 0) {
+ fstype = "lustre";
+ i--;
+ continue;
+ }
+
if (mop.mo_retry) {
int limit = i / 2 > 5 ? i / 2 : 5;
if (mop.mo_retry) {
int limit = i / 2 > 5 ? i / 2 : 5;