Whamcloud - gitweb
LU-8807 llite: check reply status in ll_migrate() 66/23666/2
authorNiu Yawei <yawei.niu@intel.com>
Wed, 9 Nov 2016 02:43:36 +0000 (21:43 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 21 Dec 2016 05:05:52 +0000 (05:05 +0000)
ll_migrate() should check reply status before trying to read
reply buffer, checking if request is NULL doesn't make sense.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I585844e0c1118fad23f19791dc95e34bc0d6e38a
Reviewed-on: https://review.whamcloud.com/23666
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/file.c

index c876263..5748812 100644 (file)
@@ -3257,15 +3257,12 @@ again:
        op_data->op_cli_flags = CLI_MIGRATE;
        rc = md_rename(ll_i2sbi(parent)->ll_md_exp, op_data, name,
                       namelen, name, namelen, &request);
        op_data->op_cli_flags = CLI_MIGRATE;
        rc = md_rename(ll_i2sbi(parent)->ll_md_exp, op_data, name,
                       namelen, name, namelen, &request);
-       if (rc == 0)
+       if (rc == 0) {
+               LASSERT(request != NULL);
                ll_update_times(request, parent);
 
                ll_update_times(request, parent);
 
-       if (request != NULL) {
                body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY);
                body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY);
-               if (body == NULL) {
-                       ptlrpc_req_finished(request);
-                       GOTO(out_close, rc = -EPROTO);
-               }
+               LASSERT(body != NULL);
 
                /* If the server does release layout lock, then we cleanup
                 * the client och here, otherwise release it in out_close: */
 
                /* If the server does release layout lock, then we cleanup
                 * the client och here, otherwise release it in out_close: */
@@ -3278,14 +3275,17 @@ again:
                        OBD_FREE_PTR(och);
                        och = NULL;
                }
                        OBD_FREE_PTR(och);
                        och = NULL;
                }
+       }
+
+       if (request != NULL) {
                ptlrpc_req_finished(request);
                ptlrpc_req_finished(request);
+               request = NULL;
        }
 
        /* Try again if the file layout has changed. */
        }
 
        /* Try again if the file layout has changed. */
-       if (rc == -EAGAIN && S_ISREG(child_inode->i_mode)) {
-               request = NULL;
+       if (rc == -EAGAIN && S_ISREG(child_inode->i_mode))
                goto again;
                goto again;
-       }
+
 out_close:
        if (och != NULL) /* close the file */
                ll_lease_close(och, child_inode, NULL);
 out_close:
        if (och != NULL) /* close the file */
                ll_lease_close(och, child_inode, NULL);