From 25170d2c786f3b7aebda83b50791abf9b42ba358 Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Thu, 14 Mar 2013 19:26:39 +0800 Subject: [PATCH] LU-2598 tests: check npages in filter_preprw() This patch checks the number of bulk I/O RPC pages with PTLRPC_MAX_BRW_PAGES in filter_preprw() to avoid LASSERT(iobuf->dr_npages < iobuf->dr_max_pages) occurring while larger I/O size is specified. Signed-off-by: Jian Yu Change-Id: I1b85866045d753359c420ed9dfd8703eec14f18e Reviewed-on: http://review.whamcloud.com/5715 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Bobi Jam --- lustre/obdfilter/filter_io.c | 7 +++++++ lustre/tests/sanity.sh | 30 ++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/lustre/obdfilter/filter_io.c b/lustre/obdfilter/filter_io.c index 859e290..46fba2b 100644 --- a/lustre/obdfilter/filter_io.c +++ b/lustre/obdfilter/filter_io.c @@ -917,6 +917,13 @@ int filter_preprw(int cmd, struct obd_export *exp, struct obdo *oa, struct niobuf_local *res, struct obd_trans_info *oti, struct lustre_capa *capa) { + if (*npages > 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, *npages, PTLRPC_MAX_BRW_PAGES); + RETURN(-EPROTO); + } + if (cmd == OBD_BRW_WRITE) return filter_preprw_write(cmd, exp, oa, objcount, obj, nb, npages, res, oti, capa); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index d942f69..d4e19b9 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -7844,6 +7844,7 @@ cleanup_obdecho_osc () { obdecho_create_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 @@ -7854,8 +7855,8 @@ 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 ] && { do_facet $node "$LCTL --device ec " \ + "test_brw 10 w v $pages $id" || 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 " \ @@ -7902,6 +7903,31 @@ test_180b() { } run_test 180b "test obdecho directly on obdfilter" +test_180c() { # LU-2598 + local rc=0 + local rmmod_remote=false + local pages=8192 # 32MB 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_create_test "$target" ost1 "$pages" + if [[ ${PIPESTATUS[0]} != 4 ]]; then + echo "obecho_create_test should fail with rc=4" + rc=1 + fi + 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 mkdir -p $DIR/$tdir || error "creating dir $DIR/$tdir" # create enough files to index the directory -- 1.8.3.1