From 3e3b02239a78ba748954bc0b6c5fabeb7eed8523 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Mon, 30 Jul 2012 18:03:33 +0400 Subject: [PATCH] LU-1581 mount: use a special separator in svname 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 Change-Id: I83e1d1e4f1fd67ae9a6453069b324696715d4fee Reviewed-on: http://review.whamcloud.com/3612 Tested-by: Hudson Reviewed-by: Jinshan Xiong Reviewed-by: Andreas Dilger Tested-by: Maloo --- lustre/include/lustre_disk.h | 7 ++++--- lustre/mgs/mgs_llog.c | 2 +- lustre/obdclass/obd_mount.c | 11 ++++++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index 508e13c..3cac2c7 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -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)) - 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 { diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 9e10fd2..a710617 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -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); - 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, diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index e76dbf8..26fc3f6 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -347,6 +347,14 @@ static int ldd_parse(struct lvfs_run_ctxt *mount_ctxt, 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: @@ -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_flags |= LDD_F_WRITECONF; + ldd->ldd_flags |= (lsi->lsi_lmd->lmd_flags & LMD_FLG_WRITECONF) ? + LDD_F_WRITECONF : 0; lsi->lsi_ldd = ldd; -- 1.8.3.1