Whamcloud - gitweb
LU-7396 llite: check request != NULL in ll_migrate 79/17079/3
authorDi Wang <di.wang@intel.com>
Thu, 5 Nov 2015 10:25:52 +0000 (02:25 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 30 Nov 2015 17:19:51 +0000 (17:19 +0000)
Check if the request is NULL, before retrieve reply body
from the request.

Signed-off-by: Di Wang <di.wang@intel.com>
Change-Id: Ifec9caf270b938b7583de0315610f930fa52649d
Reviewed-on: http://review.whamcloud.com/17079
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/llite/file.c
lustre/tests/sanity.sh

index 1b368b8..9b75dc2 100644 (file)
@@ -3061,24 +3061,32 @@ again:
        if (rc == 0)
                ll_update_times(request, parent);
 
-       body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY);
-       if (body == NULL)
-               GOTO(out_free, rc = -EPROTO);
-
-       /* If the server does release layout lock, then we cleanup
-        * the client och here, otherwise release it in out_free: */
-       if (och != NULL && body->mbo_valid & OBD_MD_CLOSE_INTENT_EXECED) {
-               obd_mod_put(och->och_mod);
-               md_clear_open_replay_data(ll_i2sbi(parent)->ll_md_exp, och);
-               och->och_fh.cookie = DEAD_HANDLE_MAGIC;
-               OBD_FREE_PTR(och);
-               och = NULL;
+       if (request != NULL) {
+               body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY);
+               if (body == NULL) {
+                       ptlrpc_req_finished(request);
+                       GOTO(out_free, rc = -EPROTO);
+               }
+
+               /* If the server does release layout lock, then we cleanup
+                * the client och here, otherwise release it in out_free: */
+               if (och != NULL &&
+                   body->mbo_valid & OBD_MD_CLOSE_INTENT_EXECED) {
+                       obd_mod_put(och->och_mod);
+                       md_clear_open_replay_data(ll_i2sbi(parent)->ll_md_exp,
+                                                 och);
+                       och->och_fh.cookie = DEAD_HANDLE_MAGIC;
+                       OBD_FREE_PTR(och);
+                       och = NULL;
+               }
+               ptlrpc_req_finished(request);
        }
 
-       ptlrpc_req_finished(request);
        /* Try again if the file layout has changed. */
-       if (rc == -EAGAIN && S_ISREG(child_inode->i_mode))
+       if (rc == -EAGAIN && S_ISREG(child_inode->i_mode)) {
+               request = NULL;
                goto again;
+       }
 out_free:
        if (child_inode != NULL) {
                if (och != NULL) /* close the file */
index fae421c..a73ace6 100755 (executable)
@@ -13053,6 +13053,18 @@ test_230f() {
 }
 run_test 230f "migrate mulitple remote link files"
 
+test_230g() {
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+
+       mkdir -p $DIR/$tdir/migrate_dir
+
+       $LFS migrate -m 1000 $DIR/$tdir/migrate_dir &&
+               error "migrating dir to non-exist MDT succeeds"
+       true
+}
+run_test 230g "migrate dir to non-exist MDT"
+
 test_231a()
 {
        # For simplicity this test assumes that max_pages_per_rpc