Commit 15c50ccc authored by Sebastien Buisson's avatar Sebastien Buisson Committed by Greg Kroah-Hartman

lustre/ptlrpc: fix 'data race condition' issues

Fix 'data race condition' defects found by Coverity version
6.5.0:
Data race condition (MISSING_LOCK)
Accessing variable without holding lock. Elsewhere,
this variable is accessed with lock held.
Signed-off-by: default avatarSebastien Buisson <sebastien.buisson@bull.net>
Reviewed-on: http://review.whamcloud.com/6575
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarOeg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 19a5b935
...@@ -1190,7 +1190,9 @@ static int after_reply(struct ptlrpc_request *req) ...@@ -1190,7 +1190,9 @@ static int after_reply(struct ptlrpc_request *req)
* will roundup it */ * will roundup it */
req->rq_replen = req->rq_nob_received; req->rq_replen = req->rq_nob_received;
req->rq_nob_received = 0; req->rq_nob_received = 0;
spin_lock(&req->rq_lock);
req->rq_resend = 1; req->rq_resend = 1;
spin_unlock(&req->rq_lock);
return 0; return 0;
} }
...@@ -1408,7 +1410,9 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req) ...@@ -1408,7 +1410,9 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req)
req->rq_status = rc; req->rq_status = rc;
return 1; return 1;
} else { } else {
spin_lock(&req->rq_lock);
req->rq_wait_ctx = 1; req->rq_wait_ctx = 1;
spin_unlock(&req->rq_lock);
return 0; return 0;
} }
} }
...@@ -1423,7 +1427,9 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req) ...@@ -1423,7 +1427,9 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req)
rc = ptl_send_rpc(req, 0); rc = ptl_send_rpc(req, 0);
if (rc) { if (rc) {
DEBUG_REQ(D_HA, req, "send failed (%d); expect timeout", rc); DEBUG_REQ(D_HA, req, "send failed (%d); expect timeout", rc);
spin_lock(&req->rq_lock);
req->rq_net_err = 1; req->rq_net_err = 1;
spin_unlock(&req->rq_lock);
return rc; return rc;
} }
return 0; return 0;
......
...@@ -511,7 +511,9 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) ...@@ -511,7 +511,9 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
CDEBUG(D_HA, "muting rpc for failed imp obd %s\n", CDEBUG(D_HA, "muting rpc for failed imp obd %s\n",
request->rq_import->imp_obd->obd_name); request->rq_import->imp_obd->obd_name);
/* this prevents us from waiting in ptlrpc_queue_wait */ /* this prevents us from waiting in ptlrpc_queue_wait */
spin_lock(&request->rq_lock);
request->rq_err = 1; request->rq_err = 1;
spin_unlock(&request->rq_lock);
request->rq_status = -ENODEV; request->rq_status = -ENODEV;
return -ENODEV; return -ENODEV;
} }
...@@ -553,7 +555,9 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) ...@@ -553,7 +555,9 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
if (rc) { if (rc) {
/* this prevents us from looping in /* this prevents us from looping in
* ptlrpc_queue_wait */ * ptlrpc_queue_wait */
spin_lock(&request->rq_lock);
request->rq_err = 1; request->rq_err = 1;
spin_unlock(&request->rq_lock);
request->rq_status = rc; request->rq_status = rc;
GOTO(cleanup_bulk, rc); GOTO(cleanup_bulk, rc);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment