From: Andreas Dilger Date: Wed, 11 Apr 2018 18:13:34 +0000 (-0600) Subject: LU-10903 obdecho: use OBD_ALLOC_LARGE for lnb X-Git-Tag: 2.11.52~42 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=8878bab7ae5f9f03b61f7a869e79bba273695131;p=fs%2Flustre-release.git LU-10903 obdecho: use OBD_ALLOC_LARGE for lnb When allocating the niobuf_local, if there are a large number of (potential) fragments this allocation can be quite large. Use OBD_ALLOC_LARGE(lnb) and OBD_FREE_LARGE(lnb) to avoid allocation errors and console noise. This was causing sanity test_180c to fail in a VM on occasion, and could also be problem in real use. Tidy up test_180[abc] to use stack_trap to handle echo device cleanup rather than having a series of conditional checks. Use "error" to report errors rather than error numbers. Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: Ib0e721f58fc0a62acca29b31fb4dfac5021cab07 Reviewed-on: https://review.whamcloud.com/31964 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Emoly Liu Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 823546d..2e66051 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -2579,11 +2579,11 @@ static int echo_client_prep_commit(const struct lu_env *env, u64 offset, u64 count, u64 batch, int async) { - struct obd_ioobj ioo; - struct niobuf_local *lnb; - struct niobuf_remote rnb; - u64 off; - u64 npages, tot_pages, apc; + struct obd_ioobj ioo; + struct niobuf_local *lnb; + struct niobuf_remote rnb; + u64 off; + u64 npages, tot_pages, apc; int i, ret = 0, brw_flags = 0; ENTRY; @@ -2594,7 +2594,7 @@ static int echo_client_prep_commit(const struct lu_env *env, apc = npages = batch >> PAGE_SHIFT; tot_pages = count >> PAGE_SHIFT; - OBD_ALLOC(lnb, apc * sizeof(struct niobuf_local)); + OBD_ALLOC_LARGE(lnb, apc * sizeof(struct niobuf_local)); if (lnb == NULL) RETURN(-ENOMEM); @@ -2660,7 +2660,7 @@ static int echo_client_prep_commit(const struct lu_env *env, } out: - OBD_FREE(lnb, apc * sizeof(struct niobuf_local)); + OBD_FREE_LARGE(lnb, apc * sizeof(struct niobuf_local)); RETURN(ret); } diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 2804dc8..c6b292b 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -12824,28 +12824,31 @@ obdecho_test() { test_180a() { [ $PARALLEL == "yes" ] && skip "skip parallel run" - remote_ost_nodsh && skip "remote OST with nodsh" - - local rc=0 - local rmmod_local=0 if ! module_loaded obdecho; then - load_module obdecho/obdecho - rmmod_local=1 + load_module obdecho/obdecho && + stack_trap "rmmod obdecho" EXIT || + error "unable to load obdecho on client" 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}' ) + 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 + if [ -n "$target" ]; then + setup_obdecho_osc $host $target && + stack_trap "cleanup_obdecho_osc $target" EXIT || + { error "obdecho setup failed with $?"; return; } + + obdecho_test ${target}_osc client || + error "obdecho_test failed on ${target}_osc" + else + $LCTL get_param osc.$osc.import + error "there is no osc.$osc.import target" + fi } run_test 180a "test obdecho on osc" @@ -12853,15 +12856,19 @@ test_180b() { [ $PARALLEL == "yes" ] && skip "skip parallel run" remote_ost_nodsh && skip "remote OST with nodsh" - local rc=0 - local rmmod_remote=0 - 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;exit}') - [[ -n $target ]] && { obdecho_test $target ost1 || rc=1; } - $rmmod_remote && do_facet ost1 "rmmod obdecho" - return $rc + stack_trap "do_facet ost1 rmmod obdecho" EXIT || + error "failed to load module obdecho" + + local target=$(do_facet ost1 $LCTL dl | + awk '/obdfilter/ { print $4; exit; }') + + if [ -n "$target" ]; then + obdecho_test $target ost1 || error "obdecho_test failed with $?" + else + do_facet ost1 $LCTL dl + error "there is no obdfilter target on ost1" + fi } run_test 180b "test obdecho directly on obdfilter" @@ -12871,23 +12878,22 @@ test_180c() { # LU-2598 [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.0) ]] && skip "Need MDS version at least 2.4.0" - 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" + stack_trap "do_facet ost1 rmmod obdecho" EXIT || + error "failed to load module obdecho" + + local target=$(do_facet ost1 $LCTL dl | + awk '/obdfilter/ { print $4; exit; }') - target=$(do_facet ost1 $LCTL dl | awk '/obdfilter/ { print $4; exit; }') if [ -n "$target" ]; then - obdecho_test "$target" ost1 "$pages" || rc=${PIPESTATUS[0]} + local pages=16384 # 64MB bulk I/O RPC size + + obdecho_test "$target" ost1 "$pages" || + error "obdecho_test with pages=$pages failed with $?" else - echo "there is no obdfilter target on ost1" - rc=2 + do_facet ost1 $LCTL dl + error "there is no obdfilter target on ost1" 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"