From 056783782eab03b341c464c85ce4a803508e390b Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Tue, 8 Nov 2016 21:43:36 -0500 Subject: [PATCH] LU-8807 llite: check reply status in ll_migrate() 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 Change-Id: I585844e0c1118fad23f19791dc95e34bc0d6e38a Reviewed-on: https://review.whamcloud.com/23666 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- lustre/llite/file.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index c876263..5748812 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -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); - if (rc == 0) + if (rc == 0) { + LASSERT(request != NULL); ll_update_times(request, parent); - if (request != NULL) { 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: */ @@ -3278,14 +3275,17 @@ again: OBD_FREE_PTR(och); och = NULL; } + } + + if (request != NULL) { ptlrpc_req_finished(request); + request = NULL; } /* 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; - } + out_close: if (och != NULL) /* close the file */ ll_lease_close(och, child_inode, NULL); -- 1.8.3.1