From 25651e5cfe270f76e151bfbc858e3cbac8462815 Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 12 Oct 2009 23:20:39 +0000 Subject: [PATCH] b=20689 i=manoj i=yujian use the correct osc name for add_failnid --- lustre/mgs/mgs_llog.c | 66 ++++++++++++++++++++++++++++----------------- lustre/tests/conf-sanity.sh | 15 ++++++----- 2 files changed, 49 insertions(+), 32 deletions(-) diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 739a385..8d6c90c 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -1523,6 +1523,18 @@ static void name_create_mdt_and_lov(char **logname, char **lovname, name_create(lovname, *logname, "-mdtlov"); } +static inline void name_create_mdt_osc(char **oscname, char *ostname, + struct fs_db *fsdb, int i) +{ + char suffix[16]; + + if (i == 0 && fsdb->fsdb_fl_oscname_18) + sprintf(suffix, "-osc"); + else + sprintf(suffix, "-osc-MDT%04x", i); + name_create(oscname, ostname, suffix); +} + /* envelope method for all layers log */ static int mgs_write_log_mdt(struct obd_device *obd, struct fs_db *fsdb, struct mgs_target_info *mti) @@ -1846,23 +1858,35 @@ static int mgs_write_log_add_failnid(struct obd_device *obd, struct fs_db *fsdb, rc = record_end_log(obd, &llh); } name_destroy(&logname); + name_destroy(&cliname); if (mti->mti_flags & LDD_F_SV_TYPE_OST) { - /* Add OST failover nids to the MDT log as well */ - name_create(&logname, mti->mti_fsname, "-MDT0000"); - rc = record_start_log(obd, &llh, logname); - if (!rc) { - rc = record_marker(obd, llh, fsdb, CM_START, - mti->mti_svname, "add failnid"); - rc = mgs_write_log_failnids(obd, mti, llh, cliname); - rc = record_marker(obd, llh, fsdb, CM_END, - mti->mti_svname, "add failnid"); - rc = record_end_log(obd, &llh); + /* Add OST failover nids to the MDT logs as well */ + int i; + + for (i = 0; i < INDEX_MAP_SIZE * 8; i++) { + if (!test_bit(i, fsdb->fsdb_mdt_index_map)) + continue; + name_create_mdt(&logname, mti->mti_fsname, i); + name_create_mdt_osc(&cliname, mti->mti_svname, fsdb, i); + + rc = record_start_log(obd, &llh, logname); + if (!rc) { + rc = record_marker(obd, llh, fsdb, CM_START, + mti->mti_svname, + "add failnid"); + rc = mgs_write_log_failnids(obd, mti, llh, + cliname); + rc = record_marker(obd, llh, fsdb, CM_END, + mti->mti_svname, + "add failnid"); + rc = record_end_log(obd, &llh); + } + name_destroy(&cliname); + name_destroy(&logname); } - name_destroy(&logname); } - name_destroy(&cliname); RETURN(rc); } @@ -2354,7 +2378,7 @@ static int mgs_write_log_param(struct obd_device *obd, struct fs_db *fsdb, if (rc) goto active_err; /* Modify mdtlov */ - /* FIXME add to all MDT logs for CMD */ + /* Add to all MDT logs for CMD */ for (i = 0; i < INDEX_MAP_SIZE * 8; i++) { if (!test_bit(i, fsdb->fsdb_mdt_index_map)) continue; @@ -2465,27 +2489,19 @@ static int mgs_write_log_param(struct obd_device *obd, struct fs_db *fsdb, /* osc params affect the MDT as well */ if (!rc && (mti->mti_flags & LDD_F_SV_TYPE_OST)) { - char mdt_index[16]; int i; for (i = 0; i < INDEX_MAP_SIZE * 8; i++){ if (!test_bit(i, fsdb->fsdb_mdt_index_map)) continue; - name_destroy(&cname); - if (i == 0 && fsdb->fsdb_fl_oscname_18) - sprintf(mdt_index, "-osc"); - else - sprintf(mdt_index, "-osc-MDT%04x", i); - name_create(&cname, mti->mti_svname, mdt_index); - + name_create_mdt_osc(&cname, mti->mti_svname, + fsdb, i); name_destroy(&logname); name_create_mdt(&logname, mti->mti_fsname, i); if (!mgs_log_is_empty(obd, logname)) - rc = mgs_wlp_lcfg(obd, fsdb, - mti, logname, - &bufs, cname, - ptr); + rc = mgs_wlp_lcfg(obd, fsdb,mti,logname, + &bufs, cname, ptr); if (rc) break; } diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 95a4c85..cb2f716 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -1,6 +1,6 @@ #!/bin/bash -# requirement: -# add uml1 uml2 uml3 in your /etc/hosts +# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*- +# vim:autoindent:shiftwidth=4:tabstop=4: # FIXME - there is no reason to use all of these different # return codes, espcially when most of them are mapped to something @@ -1048,7 +1048,7 @@ test_32b() { { skip_env "Cannot untar $DISK1_8" && return ; } load_modules - $LCTL set_param debug=$PTLDEBUG + $LCTL set_param debug="config" local NEWNAME=lustre # writeconf will cause servers to register with their current nids @@ -1060,7 +1060,8 @@ test_32b() { echo MDS uuid $UUID [ "$UUID" == "${NEWNAME}-MDT0000_UUID" ] || error "UUID is wrong: $UUID" - $TUNEFS --mgsnode=$HOSTNAME --writeconf --fsname=$NEWNAME $tmpdir/ost1 || error "tunefs failed" + $TUNEFS --mgsnode=$HOSTNAME --writeconf --fsname=$NEWNAME $tmpdir/ost1 ||\ + error "tunefs failed" start32 ost1 $tmpdir/ost1 "-o loop" || return 5 UUID=$($LCTL get_param -n obdfilter.${NEWNAME}-OST0000.uuid) echo OST uuid $UUID @@ -1075,12 +1076,12 @@ test_32b() { echo "MDC changes should succeed:" $LCTL conf_param ${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight=9 || return 9 - $LCTL conf_param lustre-MDT0000.failover.node=$NID || return 10 + $LCTL conf_param ${NEWNAME}-MDT0000.failover.node=$NID || return 10 echo "ok." echo "LOV changes should succeed:" - $LCTL pool_new lustre.interop || return 11 - $LCTL conf_param lustre-MDT0000.lov.stripesize=4M || return 12 + $LCTL pool_new ${NEWNAME}.interop || return 11 + $LCTL conf_param ${NEWNAME}-MDT0000.lov.stripesize=4M || return 12 echo "ok." # MDT and OST should have registered with new nids, so we should have -- 1.8.3.1