summaryrefslogtreecommitdiff
path: root/drivers/staging/lustre/lustre/ptlrpc/niobuf.c
diff options
context:
space:
mode:
authorSebastien Buisson <sebastien.buisson@bull.net>2014-02-28 21:16:42 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-28 19:13:21 -0800
commit15c50ccc3c4377ad02ff6da7792c1d54633d3122 (patch)
treed4bde82e211498156b9660a64a5bd3dc9a466a31 /drivers/staging/lustre/lustre/ptlrpc/niobuf.c
parent19a5b935d9d072434c9ea06720c3ffe97bad9247 (diff)
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: Sebastien Buisson <sebastien.buisson@bull.net> Reviewed-on: http://review.whamcloud.com/6575 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744 Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Oeg Drokin <oleg.drokin@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lustre/ptlrpc/niobuf.c')
-rw-r--r--drivers/staging/lustre/lustre/ptlrpc/niobuf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c
index 1e94597eaea5..a47a8d807d5b 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c
@@ -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",
request->rq_import->imp_obd->obd_name);
/* this prevents us from waiting in ptlrpc_queue_wait */
+ spin_lock(&request->rq_lock);
request->rq_err = 1;
+ spin_unlock(&request->rq_lock);
request->rq_status = -ENODEV;
return -ENODEV;
}
@@ -553,7 +555,9 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
if (rc) {
/* this prevents us from looping in
* ptlrpc_queue_wait */
+ spin_lock(&request->rq_lock);
request->rq_err = 1;
+ spin_unlock(&request->rq_lock);
request->rq_status = rc;
GOTO(cleanup_bulk, rc);
}