From 401c1eca62021d8e314a390482848f5383dff526 Mon Sep 17 00:00:00 2001 From: grev Date: Fri, 24 Jul 2009 13:54:12 +0000 Subject: [PATCH] b=20164 o=Zhenyu.Xu i=Adilger i=grev when echo client attached to OST device, o_brw_async() ops is not supported, we turn to o_brw() instead. --- lustre/obdecho/echo_client.c | 21 ++++++++++++++------- lustre/tests/sanity.sh | 37 ++++++++++++++++++++++++------------- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index b079a36..3d6536b 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -577,15 +577,22 @@ static int echo_client_kbrw(struct obd_device *obd, int rw, struct obdo *oa, oinfo.oi_oa = oa; oinfo.oi_md = lsm; - rc = obd_brw_async(rw, ec->ec_exp, &oinfo, npages, pga, oti, set); - if (rc == 0) { - rc = ptlrpc_set_wait(set); - if (rc) - CERROR("error from callback: rc = %d\n", rc); + /* OST/filter device don't support o_brw_async ops, turn to o_brw ops */ + if (ec->ec_exp && ec->ec_exp->exp_obd && + OBT(ec->ec_exp->exp_obd) && OBP(ec->ec_exp->exp_obd, brw_async)) { + rc = obd_brw_async(rw, ec->ec_exp, &oinfo, npages, pga, oti, + set); + if (rc == 0) { + rc = ptlrpc_set_wait(set); + if (rc) + CERROR("error from callback: rc = %d\n", rc); + } } else { - CDEBUG(rc == -ENOSPC ? D_INODE : D_ERROR, - "error from obd_brw_async: rc = %d\n", rc); + rc = obd_brw(rw, ec->ec_exp, &oinfo, npages, pga, oti); } + if (rc) + CDEBUG_LIMIT(rc == -ENOSPC ? D_INODE : D_ERROR, + "error from obd_brw_async: rc = %d\n", rc); ptlrpc_set_destroy(set); out: if (rc != 0 || rw != OBD_BRW_READ) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index c540b6f..5a7c2a4 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -5913,28 +5913,39 @@ run_test 170 "test lctl df to handle corrupted log =====================" obdecho_create_test() { local OBD=$1 + local node=$2 local rc=0 - $LCTL attach echo_client ec ec_uuid || rc=1 - [ $rc -eq 0 ] && { $LCTL --device ec setup $OBD || rc=2; } - [ $rc -eq 0 ] && { $LCTL --device ec create 1 || rc=3; } - [ $rc -eq 0 -o $rc -gt 2 ] && { $LCTL --device ec cleanup || rc=4; } - [ $rc -eq 0 -o $rc -gt 1 ] && { $LCTL --device ec detach || rc=5; } + do_facet $node "$LCTL attach echo_client ec ec_uuid" || rc=1 + [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec setup $OBD" || rc=2; } + [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec create 1" || rc=3; } + [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec test_brw 0 w 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; } return $rc } test_180() { - load_module obdecho/obdecho || return 1 local rc=0 + local rmmod_local=0 + local rmmod_remote=0 - local OBD=`$LCTL dl | awk ' /obdfilter/ { print $4; exit; }'` - [ "x$OBD" != "x" ] && { obdecho_create_test $OBD || rc=2; } - [[ $rc -ne 0 ]] && { rmmod obdecho; return $rc; } + lsmod | grep -q obdecho || { load_module obdecho/obdecho && rmmod_local=1; } OBD=`$LCTL dl | awk ' /-osc-/ { print $4; exit; }'` - [ "x$OBD" != "x" ] && { obdecho_create_test $OBD || rc=3; } - [[ $rc -ne 0 ]] && { rmmod obdecho; return $rc; } - - rmmod obdecho + [ "x$OBD" != "x" ] && { obdecho_create_test $OBD client || rc=2; } + [ $rmmod_local -eq 1 ] && rmmod obdecho + [ $rc -ne 0 ] && return $rc + + do_facet ost "lsmod | grep -q obdecho || { insmod ${LUSTRE}/obdecho/obdecho.ko || modprobe obdecho; }" && rmmod_remote=1 + + OBD=$(do_facet ost "$LCTL dl | awk '/obdfilter/ { print; exit; }'" | awk '{print $4;}') + [ "x$OBD" != "x" ] && { obdecho_create_test $OBD ost || rc=3; } + [ $rmmod_remote -eq 1 ] && do_facet ost "rmmod obdecho" + if [ $rc -ne 0 ]; then + error "obdecho test rc=$rc" + return $rc + fi + true } run_test 180 "test obdecho ============================================" -- 1.8.3.1