From 56efe55f3d125343e80f8bf6c7e6edb2a2ff87ef Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Thu, 6 Jun 2013 14:34:32 +0200 Subject: [PATCH] LU-2744 build: 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 Change-Id: Ia9bad7782b6289e84c11e7998957c732508e10a5 Reviewed-on: http://review.whamcloud.com/6567 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Liang Zhen Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- lnet/selftest/conrpc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lnet/selftest/conrpc.c b/lnet/selftest/conrpc.c index 27ad326..a7729ed 100644 --- a/lnet/selftest/conrpc.c +++ b/lnet/selftest/conrpc.c @@ -949,8 +949,12 @@ lstcon_sesnew_stat_reply(lstcon_rpc_trans_t *trans, return status; if (!trans->tas_feats_updated) { - trans->tas_feats_updated = 1; - trans->tas_features = reply->msg_ses_feats; + spin_lock(&console_session.ses_rpc_lock); + if (!trans->tas_feats_updated) { /* recheck with lock */ + trans->tas_feats_updated = 1; + trans->tas_features = reply->msg_ses_feats; + } + spin_unlock(&console_session.ses_rpc_lock); } if (reply->msg_ses_feats != trans->tas_features) { -- 1.8.3.1