Whamcloud - gitweb
b=22828 fix unnormalized Linux symbols
[fs/lustre-release.git] / lustre / utils / mount_lustre.c
index f8fdb0f..6b7cfe5 100644 (file)
@@ -26,7 +26,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -68,7 +68,7 @@ int          nomtab = 0;
 int          fake = 0;
 int          force = 0;
 int          retry = 0;
-int          md_stripe_cache_size = 2048;
+int          md_stripe_cache_size = 16384;
 char         *progname = NULL;
 
 void usage(FILE *out)
@@ -291,18 +291,19 @@ int parse_options(char *orig_options, int *flagp)
                  * manner */
                 arg = opt;
                 val = strchr(opt, '=');
-                if (val != NULL) {
-                        if (strncmp(arg, "md_stripe_cache_size", 20) == 0) {
-                                md_stripe_cache_size = atoi(val + 1);
-                        } else if (strncmp(arg, "retry", 5) == 0) {
-                                retry = atoi(val + 1);
-                                if (retry > MAX_RETRIES)
-                                        retry = MAX_RETRIES;
-                                else if (retry < 0)
-                                        retry = 0;
-                        } else if (strncmp(arg, "mgssec", 6) == 0) {
-                                append_option(options, opt);
-                        }
+                /* please note that some ldiskfs mount options are also in the form
+                 * of param=value. We should pay attention not to remove those
+                 * mount options, see bug 22097. */
+                if (val && strncmp(arg, "md_stripe_cache_size", 20) == 0) {
+                        md_stripe_cache_size = atoi(val + 1);
+                } else if (val && strncmp(arg, "retry", 5) == 0) {
+                        retry = atoi(val + 1);
+                        if (retry > MAX_RETRIES)
+                                retry = MAX_RETRIES;
+                        else if (retry < 0)
+                                retry = 0;
+                } else if (val && strncmp(arg, "mgssec", 6) == 0) {
+                        append_option(options, opt);
                 } else if (strncmp(opt, "force", 5) == 0) {
                         //XXX special check for 'force' option
                         ++force;
@@ -493,7 +494,8 @@ set_params:
 int main(int argc, char *const argv[])
 {
         char default_options[] = "";
-        char *usource, *source, *target, *ptr;
+        char *usource, *source;
+        char target[PATH_MAX] = {'\0'};
         char *options, *optcopy, *orig_options = default_options;
         int i, nargs = 3, opt, rc, flags, optlen;
         static struct option long_opt[] = {
@@ -561,11 +563,11 @@ int main(int argc, char *const argv[])
                 usage(stderr);
         }
 
-        target = argv[optind + 1];
-        ptr = target + strlen(target) - 1;
-        while ((ptr > target) && (*ptr == '/')) {
-                *ptr = 0;
-                ptr--;
+        if (realpath(argv[optind + 1], target) == NULL) {
+                rc = errno;
+                fprintf(stderr, "warning: %s: cannot resolve: %s\n",
+                        argv[optind + 1], strerror(errno));
+                return rc;
         }
 
         if (verbose) {