From: Jian Yu Date: Mon, 20 May 2013 05:33:58 +0000 (+0800) Subject: LU-2598 tests: check nr_local in ofd_preprw() X-Git-Tag: 2.4.51~77 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=fd7466439be3039cb27f723c57be73317b5e48ba;p=fs%2Flustre-release.git LU-2598 tests: check nr_local in ofd_preprw() This patch checks the number of bulk I/O RPC pages with PTLRPC_MAX_BRW_PAGES in ofd_preprw() to avoid LASSERT(iobuf->dr_npages < iobuf->dr_max_pages) occurring while larger I/O size is specified. The patch also fixes echo_client_prep_commit() to reuse the env context so as to avoid LASSERT(info->fti_exp == NULL) occurring while the bulk I/O size is larger than PTLRPC_MAX_BRW_SIZE. The patch also improves obdfilter-survey to handle the case while interoprating with old server. Test-Parameters: envdefinitions=SLOW=yes,ENABLE_QUOTA=yes \ testlist=obdfilter-survey Signed-off-by: Jian Yu Change-Id: Ifa7b720da1e3fc752f85bcfa6968eb16f93af2fa Reviewed-on: http://review.whamcloud.com/6394 Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger Tested-by: Hudson Tested-by: Maloo --- diff --git a/lustre-iokit/obdfilter-survey/obdfilter-survey b/lustre-iokit/obdfilter-survey/obdfilter-survey index 19cdaf0..c4980c9 100755 --- a/lustre-iokit/obdfilter-survey/obdfilter-survey +++ b/lustre-iokit/obdfilter-survey/obdfilter-survey @@ -61,6 +61,7 @@ size=${size:-16384} # record size (KBytes) ( 7168 max) rszlo=${rszlo:-1024} rszhi=${rszhi:-1024} +rszmax=${rszmax:-4096} # number of objects per OST nobjlo=${nobjlo:-1} @@ -194,6 +195,32 @@ print_summary () { echo $minusn "$*" } +version_code() { + # split arguments like "2.3.61" into "2", "3", "61" + eval set -- $(tr "[:punct:]" " " <<< $*) + echo -n "$((($1 << 16) | ($2 << 8) | $3))" +} + +get_lustre_version() { + local host=${1:-${unique_hosts[0]}} + remote_shell $host $lctl get_param -n version | + awk '/^lustre:/ {print $2}' +} + +# Check whether the record size (KBytes) exceeds the maximum bulk I/O RPC size +# or not. +check_record_size() { + [ $(version_code $(get_lustre_version)) -lt $(version_code 2.3.61) ] && + rszmax=1024 + + if [ "$rszhi" -gt "$rszmax" ]; then + echo "Test disk case support maximum ${rszmax}KB IO data" \ + "(rszhi=$rszhi is too big), please use a smaller value." + return 1 + fi + return 0 +} + # Customisation variables ##################################################################### # One can change variable values in this section as per requirements @@ -285,11 +312,6 @@ for trgt in $targets; do ndevs=$((ndevs+1)) done if [ $case == "disk" ]; then - if [ $rszhi -gt 1024 ]; then - echo "Test disk case support maximum 1024KB IO data" \ - "(rszhi=$rszhi is too big) please use a smaller value." - exit 1 - fi for ((i = 0; i < $ndevs; i++)); do ost_names[$i]=${client_names[$i]} done @@ -382,6 +404,11 @@ fi # disable portals debug and get obdecho loaded on all relevant hosts unique_hosts=(`unique ${host_names[@]}`) load_obdechos + +if [ $case == "disk" ]; then + check_record_size || cleanup ${PIPESTATUS[0]} +fi + pidcount=0 for host in ${unique_hosts[@]}; do host_vmstatf=${vmstatf}_${host} diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 126a985..503a8bf 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -2654,6 +2654,10 @@ static int echo_client_prep_commit(const struct lu_env *env, /* Reset oti otherwise it would confuse ldiskfs. */ memset(oti, 0, sizeof(*oti)); + + /* Reuse env context. */ + lu_context_exit((struct lu_context *)&env->le_ctx); + lu_context_enter((struct lu_context *)&env->le_ctx); } out: diff --git a/lustre/ofd/ofd_io.c b/lustre/ofd/ofd_io.c index a139bda..b90bc8a 100644 --- a/lustre/ofd/ofd_io.c +++ b/lustre/ofd/ofd_io.c @@ -218,6 +218,13 @@ int ofd_preprw(const struct lu_env* env, int cmd, struct obd_export *exp, struct ofd_thread_info *info; int rc = 0; + if (*nr_local > PTLRPC_MAX_BRW_PAGES) { + CERROR("%s: bulk has too many pages %d, which exceeds the" + "maximum pages per RPC of %d\n", + exp->exp_obd->obd_name, *nr_local, PTLRPC_MAX_BRW_PAGES); + RETURN(-EPROTO); + } + rc = lu_env_refill((struct lu_env *)env); LASSERT(rc == 0); info = ofd_info_init(env, exp); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 2244d5a..d3f3b5b 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -9541,6 +9541,7 @@ cleanup_obdecho_osc () { obdecho_test() { local OBD=$1 local node=$2 + local pages=${3:-64} local rc=0 local id do_facet $node "$LCTL attach echo_client ec ec_uuid" || rc=1 @@ -9553,8 +9554,8 @@ obdecho_test() { echo "New object id is $id" [ $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 " \ + "test_brw 10 w v $pages $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 " \ @@ -9607,6 +9608,32 @@ test_180b() { } run_test 180b "test obdecho directly on obdfilter" +test_180c() { # LU-2598 + [ $PARALLEL == "yes" ] && skip "skip parallel run" && return + [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.0) ]] && + skip "Need MDS version at least 2.4.0" && return + + local rc=0 + local rmmod_remote=false + local pages=16384 # 64MB bulk I/O RPC size + local target + + do_rpc_nodes $(facet_active_host ost1) load_module obdecho/obdecho && + rmmod_remote=true || error "failed to load module obdecho" + + target=$(do_facet ost1 $LCTL dl | awk '/obdfilter/ {print $4}'|head -1) + if [[ -n $target ]]; then + obdecho_test "$target" ost1 "$pages" || + rc=${PIPESTATUS[0]} + else + echo "there is no obdfilter target on ost1" + rc=2 + fi + $rmmod_remote && do_facet ost1 "rmmod obdecho" || true + return $rc +} +run_test 180c "test huge bulk I/O size on obdfilter, don't LASSERT" + test_181() { # bug 22177 test_mkdir -p $DIR/$tdir || error "creating dir $DIR/$tdir" # create enough files to index the directory