From: wang di Date: Fri, 3 May 2013 07:00:10 +0000 (-0700) Subject: LU-3267 utils: missing setting echo seq for getattr/setattr X-Git-Tag: 2.3.65~8 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=3e2d4d2d7477dd338a87de103027d37865285e44;hp=2a7e1688e2c9bff8f18f5596c112c445d0039e94 LU-3267 utils: missing setting echo seq for getattr/setattr It should set echo seq before do echo getattr/setattr, otherwise echo_client will regard it as the object with MDT0 sequence. Signed-off-by: wang di Change-Id: I1ea6cf0c9ef1edc5a81ba6f50345916deea4f95c Reviewed-on: http://review.whamcloud.com/6263 Reviewed-by: Andreas Dilger Tested-by: Hudson Tested-by: Maloo Reviewed-by: Lai Siyao --- diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 5e9de0d..bbb5f52 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -1085,8 +1085,9 @@ static struct echo_object *cl_echo_object_find(struct echo_device *d, LASSERT(lsmp); lsm = *lsmp; LASSERT(lsm); - LASSERT(ostid_id(&lsm->lsm_oi) != 0); - LASSERT(ostid_seq(&lsm->lsm_oi) == FID_SEQ_ECHO); + LASSERTF(ostid_id(&lsm->lsm_oi) != 0, DOSTID"\n", POSTID(&lsm->lsm_oi)); + LASSERTF(ostid_seq(&lsm->lsm_oi) == FID_SEQ_ECHO, DOSTID"\n", + POSTID(&lsm->lsm_oi)); /* Never return an object if the obd is to be freed. */ if (echo_dev2cl(d)->cd_lu_dev.ld_obd->obd_stopping) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index c53a864..2244d5a 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -9538,7 +9538,7 @@ cleanup_obdecho_osc () { return 0 } -obdecho_create_test() { +obdecho_test() { local OBD=$1 local node=$2 local rc=0 @@ -9551,9 +9551,13 @@ obdecho_create_test() { [ ${PIPESTATUS[0]} -eq 0 -a -n "$id" ] || rc=3 fi echo "New object id is $id" - [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec test_brw 10 w v 64 $id" || - rc=4; } - [ $rc -eq 0 -o $rc -gt 2 ] && { do_facet $node "$LCTL --device ec " \ + [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec getattr $id" || + rc=4; } + [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec test_brw 10 w v 64 $id" || + rc=4; } + [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec destroy $id 1" || + rc=4; } + [ $rc -eq 0 -o $rc -gt 2 ] && { do_facet $node "$LCTL --device ec " \ "cleanup" || rc=5; } [ $rc -eq 0 -o $rc -gt 1 ] && { do_facet $node "$LCTL --device ec " \ "detach" || rc=6; } @@ -9563,43 +9567,43 @@ obdecho_create_test() { test_180a() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return - remote_ost_nodsh && skip "remote OST with nodsh" && return - local rc=0 - local rmmod_local=0 + remote_ost_nodsh && skip "remote OST with nodsh" && return + local rc=0 + local rmmod_local=0 - if ! module_loaded obdecho; then - load_module obdecho/obdecho - rmmod_local=1 - fi + if ! module_loaded obdecho; then + load_module obdecho/obdecho + rmmod_local=1 + fi - local osc=$($LCTL dl | grep -v mdt | awk '$3 == "osc" {print $4; exit}') - local host=$(lctl get_param -n osc.$osc.import | - awk '/current_connection:/ {print $2}' ) - local target=$(lctl get_param -n osc.$osc.import | - awk '/target:/ {print $2}' ) - target=${target%_UUID} - - [[ -n $target ]] && { setup_obdecho_osc $host $target || rc=1; } || rc=1 - [ $rc -eq 0 ] && { obdecho_create_test ${target}_osc client || rc=2; } - [[ -n $target ]] && cleanup_obdecho_osc $target - [ $rmmod_local -eq 1 ] && rmmod obdecho - return $rc + local osc=$($LCTL dl | grep -v mdt | awk '$3 == "osc" {print $4; exit}') + local host=$(lctl get_param -n osc.$osc.import | + awk '/current_connection:/ {print $2}' ) + local target=$(lctl get_param -n osc.$osc.import | + awk '/target:/ {print $2}' ) + target=${target%_UUID} + + [[ -n $target ]] && { setup_obdecho_osc $host $target || rc=1; } || rc=1 + [ $rc -eq 0 ] && { obdecho_test ${target}_osc client || rc=2; } + [[ -n $target ]] && cleanup_obdecho_osc $target + [ $rmmod_local -eq 1 ] && rmmod obdecho + return $rc } run_test 180a "test obdecho on osc" test_180b() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return - remote_ost_nodsh && skip "remote OST with nodsh" && return - local rc=0 - local rmmod_remote=0 - - do_facet ost1 "lsmod | grep -q obdecho || " \ - "{ insmod ${LUSTRE}/obdecho/obdecho.ko || " \ - "modprobe obdecho; }" && rmmod_remote=1 - target=$(do_facet ost1 $LCTL dl | awk '/obdfilter/ {print $4;exit}') - [[ -n $target ]] && { obdecho_create_test $target ost1 || rc=1; } - [ $rmmod_remote -eq 1 ] && do_facet ost1 "rmmod obdecho" - return $rc + remote_ost_nodsh && skip "remote OST with nodsh" && return + local rc=0 + local rmmod_remote=0 + + do_facet ost1 "lsmod | grep -q obdecho || " \ + "{ insmod ${LUSTRE}/obdecho/obdecho.ko || " \ + "modprobe obdecho; }" && rmmod_remote=1 + target=$(do_facet ost1 $LCTL dl | awk '/obdfilter/ {print $4;exit}') + [[ -n $target ]] && { obdecho_test $target ost1 || rc=1; } + [ $rmmod_remote -eq 1 ] && do_facet ost1 "rmmod obdecho" + return $rc } run_test 180b "test obdecho directly on obdfilter" diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index 1d80c90..bbcb244 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -1585,9 +1585,9 @@ int jt_obd_create(int argc, char **argv) gettimeofday(&next_time, NULL); next_time.tv_sec -= verbose; + ostid_set_seq_echo(&data.ioc_obdo1.o_oi); for (i = 1, next_count = verbose; i <= count && shmem_running(); i++) { data.ioc_obdo1.o_mode = mode; - ostid_set_seq_echo(&data.ioc_obdo1.o_oi); ostid_set_id(&data.ioc_obdo1.o_oi, base_id); data.ioc_obdo1.o_uid = 0; data.ioc_obdo1.o_gid = 0; @@ -1641,6 +1641,7 @@ int jt_obd_setattr(int argc, char **argv) if (argc != 2) return CMD_HELP; + ostid_set_seq_echo(&data.ioc_obdo1.o_oi); ostid_set_id(&data.ioc_obdo1.o_oi, strtoull(argv[1], &end, 0)); if (*end) { fprintf(stderr, "error: %s: invalid objid '%s'\n", @@ -1720,6 +1721,7 @@ int jt_obd_test_setattr(int argc, char **argv) printf("%s: setting "LPD64" attrs (objid "LPX64"): %s", jt_cmdname(argv[0]), count, objid, ctime(&start.tv_sec)); + ostid_set_seq_echo(&data.ioc_obdo1.o_oi); for (i = 1, next_count = verbose; i <= count && shmem_running(); i++) { ostid_set_id(&data.ioc_obdo1.o_oi, objid); data.ioc_obdo1.o_mode = S_IFREG; @@ -1804,6 +1806,7 @@ int jt_obd_destroy(int argc, char **argv) gettimeofday(&next_time, NULL); next_time.tv_sec -= verbose; + ostid_set_seq_echo(&data.ioc_obdo1.o_oi); for (i = 1, next_count = verbose; i <= count && shmem_running(); i++, id++) { ostid_set_id(&data.ioc_obdo1.o_oi, id); data.ioc_obdo1.o_mode = S_IFREG | 0644; @@ -1845,6 +1848,7 @@ int jt_obd_getattr(int argc, char **argv) memset(&data, 0, sizeof(data)); data.ioc_dev = cur_device; + ostid_set_seq_echo(&data.ioc_obdo1.o_oi); ostid_set_id(&data.ioc_obdo1.o_oi, strtoull(argv[1], &end, 0)); if (*end) { fprintf(stderr, "error: %s: invalid objid '%s'\n", @@ -1926,6 +1930,7 @@ int jt_obd_test_getattr(int argc, char **argv) printf("%s: getting "LPD64" attrs (objid "LPX64"): %s", jt_cmdname(argv[0]), count, objid, ctime(&start.tv_sec)); + ostid_set_seq_echo(&data.ioc_obdo1.o_oi); for (i = 1, next_count = verbose; i <= count && shmem_running(); i++) { ostid_set_id(&data.ioc_obdo1.o_oi, objid); data.ioc_obdo1.o_mode = S_IFREG;