#define LDD_F_SV_TYPE_MGS 0x0004
#define LDD_F_NEED_INDEX 0x0010 /* need an index assignment */
#define LDD_F_VIRGIN 0x0020 /* never registered */
-#define LDD_F_UPDATE 0x0040 /* update all related config logs */
+#define LDD_F_UPDATE 0x0040 /* update config for this server */
#define LDD_F_REWRITE_LDD 0x0080 /* rewrite the LDD */
#define LDD_F_WRITECONF 0x0100 /* regenerate all logs for this fs */
#define LDD_F_UPGRADE14 0x0200 /* COMPAT_14 */
no other services */
#define LMD_FLG_NOMGS 0x0020 /* Only start target for servers, reusing
existing MGS services */
+#define LMD_FLG_WRITECONF 0x0040 /* Rewrite config log */
#define lmd_is_client(x) ((x)->lmd_flags & LMD_FLG_CLIENT)
lustre_swab_mgs_target_info);
LASSERT(mti);
+ if (mti->mti_flags & LDD_F_NEED_INDEX)
+ mti->mti_flags |= LDD_F_WRITECONF;
+
if (!(mti->mti_flags & (LDD_F_WRITECONF | LDD_F_UPGRADE14 |
LDD_F_UPDATE))) {
/* We're just here as a startup ping. */
CDEBUG(D_MGS, "Server %s is running on %s\n",
mti->mti_svname, obd_export_nid2str(req->rq_export));
rc = mgs_check_target(obd, mti);
+
/* above will set appropriate mti flags */
if (rc <= 0)
/* Nothing wrong, or fatal error */
mti->mti_lustre_ver = LUSTRE_VERSION_CODE;
mti->mti_config_ver = 0;
+ if (lsi->lsi_lmd->lmd_flags & LMD_FLG_WRITECONF)
+ ldd->ldd_flags |= LDD_F_WRITECONF;
mti->mti_flags = ldd->ldd_flags;
mti->mti_stripe_index = ldd->ldd_svindex;
memcpy(mti->mti_uuid, ldd->ldd_uuid, sizeof(mti->mti_uuid));
/* Wait here forever until the mount refcount is 0 before completing umount,
* else we risk dereferencing a null pointer.
- * LNET may take e.g. 165s before killing zombies.
+ * LNET may take e.g. 165s before killing zombies.
*/
static void server_wait_finished(struct vfsmount *mnt)
{
waited);
/* Cannot use l_event_wait() for an interruptible sleep. */
waited += 3;
- blocked = l_w_e_set_sigs(sigmask(SIGKILL));
+ blocked = l_w_e_set_sigs(sigmask(SIGKILL));
rc = cfs_waitq_wait_event_interruptible_timeout(
- waitq,
+ waitq,
(cfs_atomic_read(&mnt->mnt_count) == 1),
cfs_time_seconds(3));
cfs_block_sigs(blocked);
if (rc < 0) {
LCONSOLE_EMERG("Danger: interrupted umount %p with "
"%d refs!\n",
- mnt, atomic_read(&mnt->mnt_count));
+ mnt, atomic_read(&mnt->mnt_count));
break;
}
}
} else if (strncmp(s1, "nomgs", 5) == 0) {
lmd->lmd_flags |= LMD_FLG_NOMGS;
clear++;
+ } else if (strncmp(s1, "writeconf", 9) == 0) {
+ lmd->lmd_flags |= LMD_FLG_WRITECONF;
+ clear++;
/* ost exclusion list */
} else if (strncmp(s1, "exclude=", 8) == 0) {
rc = lmd_make_exclusion(lmd, s1 + 7);
start_mds() {
echo "start mds service on `facet_active_host mds`"
- start mds $MDSDEV $MDS_MOUNT_OPTS || return 94
+ start mds $MDSDEV $MDS_MOUNT_OPTS $@ || return 94
}
stop_mgs() {
start_ost() {
echo "start ost1 service on `facet_active_host ost1`"
- start ost1 `ostdevname 1` $OST_MOUNT_OPTS || return 95
+ start ost1 `ostdevname 1` $OST_MOUNT_OPTS $@ || return 95
}
stop_ost() {
start_ost2() {
echo "start ost2 service on `facet_active_host ost2`"
- start ost2 `ostdevname 2` $OST_MOUNT_OPTS || return 92
+ start ost2 `ostdevname 2` $OST_MOUNT_OPTS $@ || return 92
}
stop_ost2() {
equals_msg `basename $0`: test complete
[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true
+count_osts() {
+ do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
+}
+
+test_58() {
+ start_mds >> /dev/null
+ local C1=$(count_osts)
+ echo "original ost count: $C1 (expect > 0)"
+ stop_mds >> /dev/null
+ start_mds -o writeconf >> /dev/null || error "MDT start failed"
+ local C2=$(count_osts)
+ echo "after mdt writeconf count: $C2 (expect 0)"
+ [ $C1 -gt 0 ] && [ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
+ echo "OST start without writeconf should fail:"
+ start_ost >> /dev/null && error "OST start without writeconf didn't fail"
+ echo "OST start with writeconf should succeed:"
+ start_ost -o writeconf >> /dev/null || error "OST1 start failed"
+ local C3=$(count_osts)
+ echo "after ost writeconf count: $C3 (expect 1)"
+ [ $C3 -eq 1 ] || error "new OST writeconf should add:"
+ start_ost2 -o writeconf >> /dev/null || error "OST2 start failed"
+ local C4=$(count_osts)
+ echo "after ost2 writeconf count: $C4 (expect 2)"
+ [ $C4 -eq 2 ] || error "OST2 writeconf should add log"
+ stop_ost2 >> /dev/null
+ cleanup_nocli >> /dev/null
+}
+run_test 58 "writeconf mount option"
+