Whamcloud - gitweb
LU-3856 mount: fix volume label update 12/7712/3
authorAlexander.Boyko <alexander_boyko@xyratex.com>
Fri, 20 Sep 2013 11:51:42 +0000 (15:51 +0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 24 Sep 2013 17:11:46 +0000 (17:11 +0000)
The -n|--nomtab options is used to do not update
/etc/mtab after mount, but this option prevents to
update volume label also. This patch resolve this issue.

Signed-off-by: Alexander Boyko <alexander_boyko@xyratex.com>
Xyratex-bug-id: MRP-1325
Change-Id: Ib39de6a64c0aaeb4eff1b8d88fd7c9d4514c6c7e
Reviewed-on: http://review.whamcloud.com/7712
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Hudson
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/utils/mount_lustre.c

index cc32fba..c8fe8a6 100644 (file)
@@ -685,7 +685,18 @@ int main(int argc, char *const argv[])
                 for (i = 0, rc = -EAGAIN; i <= mop.mo_retry && rc != 0; i++) {
                        rc = mount(mop.mo_source, mop.mo_target, "lustre",
                                   flags, (void *)options);
-                        if (rc) {
+                       if (rc == 0) {
+                               /* change label from <fsname>:<index> to
+                                * <fsname>-<index> to indicate the device has
+                                *  been registered. only if the label is
+                                *  supposed to be changed and target service
+                                *  is supposed to start */
+                               if (mop.mo_ldd.ldd_flags &
+                                  (LDD_F_VIRGIN | LDD_F_WRITECONF)) {
+                                       if (mop.mo_nosvc == 0)
+                                               (void)osd_label_lustre(&mop);
+                               }
+                       } else {
                                 if (verbose) {
                                         fprintf(stderr, "%s: mount %s at %s "
                                                 "failed: %s retries left: "
@@ -771,16 +782,7 @@ int main(int argc, char *const argv[])
        } else if (!mop.mo_nomtab) {
                rc = update_mtab_entry(mop.mo_usource, mop.mo_target, "lustre",
                                       mop.mo_orig_options, 0,0,0);
-
-               /* change label from <fsname>:<index> to <fsname>-<index>
-                * to indicate the device has been registered.
-                * only if the label is supposed to be changed and
-                * target service is supposed to start */
-               if (mop.mo_ldd.ldd_flags & (LDD_F_VIRGIN | LDD_F_WRITECONF)) {
-                       if (mop.mo_nosvc == 0 )
-                               (void) osd_label_lustre(&mop);
-               }
-        }
+       }
 
        free(options);
        /* mo_usource should be freed, but we can rely on the kernel */