Whamcloud - gitweb
LU-1279 utils: mount.lustre load ptlrpc module if necessary
[fs/lustre-release.git] / lustre / utils / mount_lustre.c
index 9be94a6..374815e 100644 (file)
@@ -42,6 +42,7 @@
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
+#include "mount_utils.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -52,7 +53,6 @@
 #include <lustre_ver.h>
 #include <ctype.h>
 #include <limits.h>
-#include "mount_utils.h"
 
 #define MAXOPT 4096
 #define MAX_RETRIES 99
@@ -364,8 +364,6 @@ static int parse_ldd(char *source, struct mount_opts *mop, char *options)
                append_option(options, "virgin");
        if (ldd->ldd_flags & LDD_F_WRITECONF)
                append_option(options, "writeconf");
-       if (ldd->ldd_flags & LDD_F_IAM_DIR)
-               append_option(options, "iam");
        if (ldd->ldd_flags & LDD_F_NO_PRIMNODE)
                append_option(options, "noprimnode");
 
@@ -473,8 +471,6 @@ static int parse_opts(int argc, char *const argv[], struct mount_opts *mop)
         * symbolic link for instance
         */
        if (realpath(mop->mo_usource, real_path) != NULL) {
-               mop->mo_usource = strdup(real_path);
-
                ptr = strrchr(real_path, '/');
                if (ptr && strncmp(ptr, "/dm-", 4) == 0 && isdigit(*(ptr + 4))) {
                        snprintf(path, sizeof(path), "/sys/block/%s/dm/name", ptr+1);
@@ -487,6 +483,7 @@ static int parse_opts(int argc, char *const argv[], struct mount_opts *mop)
                                fclose(f);
                        }
                }
+               mop->mo_usource = strdup(real_path);
        }
 
        ptr = strstr(mop->mo_usource, ":/");
@@ -517,6 +514,12 @@ int main(int argc, char *const argv[])
        progname = strrchr(argv[0], '/');
        progname = progname ? progname + 1 : argv[0];
 
+       /*
+        * LU-1279. When LNET modules have not loaded, and mounting multiple
+        * targets at the same time could fail.
+        */
+       rc = system("/sbin/modprobe ptlrpc 2>&1 > /dev/null");
+
        set_defaults(&mop);
 
        rc = osd_init();
@@ -638,6 +641,9 @@ int main(int argc, char *const argv[])
 
                 fprintf(stderr, "%s: mount %s at %s failed: %s\n", progname,
                        mop.mo_usource, mop.mo_target, strerror(errno));
+               if (errno == EBUSY)
+                       fprintf(stderr, "Is the backend filesystem mounted?\n"
+                                       "Check /etc/mtab and /proc/mounts\n");
                 if (errno == ENODEV)
                         fprintf(stderr, "Are the lustre modules loaded?\n"
                                 "Check /etc/modprobe.conf and "