Whamcloud - gitweb
LU-1581 mount: use a special separator in svname
authorAlex Zhuravlev <bzzz@whamcloud.com>
Mon, 30 Jul 2012 14:03:33 +0000 (18:03 +0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 17 Aug 2012 04:09:11 +0000 (00:09 -0400)
with this new approach mkfs marks fresh filesystem
by a special separator (:) between fsname and service
name. then mount utility recognizes this separator
and passes 'writeconf' option to the kernel mount.
upon this first mount (and having a new configuration
profile on MGS) mount utility replaces ':' with regular
'-' in svname and sets label to that.

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I83e1d1e4f1fd67ae9a6453069b324696715d4fee
Reviewed-on: http://review.whamcloud.com/3612
Tested-by: Hudson
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/include/lustre_disk.h
lustre/mgs/mgs_llog.c
lustre/obdclass/obd_mount.c

index 508e13c..3cac2c7 100644 (file)
@@ -182,9 +182,10 @@ static inline int server_make_name(__u32 flags, __u16 index, char *fs,
 {
         if (flags & (LDD_F_SV_TYPE_MDT | LDD_F_SV_TYPE_OST)) {
                 if (!(flags & LDD_F_SV_ALL))
 {
         if (flags & (LDD_F_SV_TYPE_MDT | LDD_F_SV_TYPE_OST)) {
                 if (!(flags & LDD_F_SV_ALL))
-                        sprintf(name, "%.8s-%s%04x", fs,
-                                (flags & LDD_F_SV_TYPE_MDT) ? "MDT" : "OST",
-                                index);
+                       sprintf(name, "%.8s%c%s%04x", fs,
+                               (flags & LDD_F_VIRGIN) ? ':' : '-',
+                               (flags & LDD_F_SV_TYPE_MDT) ? "MDT" : "OST",
+                               index);
         } else if (flags & LDD_F_SV_TYPE_MGS) {
                 sprintf(name, "MGS");
         } else {
         } else if (flags & LDD_F_SV_TYPE_MGS) {
                 sprintf(name, "MGS");
         } else {
index 9e10fd2..a710617 100644 (file)
@@ -599,7 +599,7 @@ static int mgs_set_index(struct obd_device *obd, struct mgs_target_info *mti)
 
         cfs_set_bit(mti->mti_stripe_index, imap);
         cfs_clear_bit(FSDB_LOG_EMPTY, &fsdb->fsdb_flags);
 
         cfs_set_bit(mti->mti_stripe_index, imap);
         cfs_clear_bit(FSDB_LOG_EMPTY, &fsdb->fsdb_flags);
-        server_make_name(mti->mti_flags, mti->mti_stripe_index,
+       server_make_name(mti->mti_flags & ~LDD_F_VIRGIN, mti->mti_stripe_index,
                          mti->mti_fsname, mti->mti_svname);
 
         CDEBUG(D_MGS, "Set index for %s to %d\n", mti->mti_svname,
                          mti->mti_fsname, mti->mti_svname);
 
         CDEBUG(D_MGS, "Set index for %s to %d\n", mti->mti_svname,
index e76dbf8..26fc3f6 100644 (file)
@@ -347,6 +347,14 @@ static int ldd_parse(struct lvfs_run_ctxt *mount_ctxt,
                 GOTO(out_close, rc = -EINVAL);
         }
 
                 GOTO(out_close, rc = -EINVAL);
         }
 
+       /* svname of the form lustre:OST1234 means never registered */
+       rc = strlen(ldd->ldd_svname);
+       if (ldd->ldd_svname[rc - 8] == ':') {
+               ldd->ldd_svname[rc - 8] = '-';
+               ldd->ldd_flags |= LDD_F_VIRGIN;
+       }
+       rc = 0;
+
 out_close:
         filp_close(file, 0);
 out:
 out_close:
         filp_close(file, 0);
 out:
@@ -1488,7 +1496,8 @@ static int lsi_prepare(struct lustre_sb_info *lsi)
        ldd->ldd_fsname[len] = '\0';
 
        ldd->ldd_svindex = simple_strtoul(p + 4, NULL, 16);
        ldd->ldd_fsname[len] = '\0';
 
        ldd->ldd_svindex = simple_strtoul(p + 4, NULL, 16);
-       ldd->ldd_flags |= LDD_F_WRITECONF;
+       ldd->ldd_flags |= (lsi->lsi_lmd->lmd_flags & LMD_FLG_WRITECONF) ?
+                               LDD_F_WRITECONF : 0;
 
        lsi->lsi_ldd = ldd;
 
 
        lsi->lsi_ldd = ldd;