Whamcloud - gitweb
LU-2598 tests: check npages in filter_preprw()
authorJian Yu <jian.yu@intel.com>
Thu, 14 Mar 2013 11:26:39 +0000 (19:26 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 18 Mar 2013 04:57:58 +0000 (00:57 -0400)
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 <jian.yu@intel.com>
Change-Id: I1b85866045d753359c420ed9dfd8703eec14f18e
Reviewed-on: http://review.whamcloud.com/5715
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
lustre/obdfilter/filter_io.c
lustre/tests/sanity.sh

index 859e290..46fba2b 100644 (file)
@@ -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);
index d942f69..d4e19b9 100644 (file)
@@ -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