From: Sebastien Buisson Date: Thu, 6 Jun 2013 12:36:36 +0000 (+0200) Subject: LU-2744 build: fix 'data race condition' issues X-Git-Tag: 2.4.52~20 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=f3f003b4095e1849b51a4fbd8d78e29749c6d569;hp=a0374f85c815e48d645f9b720250efb45745d441 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: I9c5eac037030f9f2fc49a26aaf2e1a125a2a0993 Reviewed-on: http://review.whamcloud.com/6569 Reviewed-by: Bob Glossman Tested-by: Hudson Reviewed-by: Keith Mannthey Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lustre_import.h b/lustre/include/lustre_import.h index 6511c36..acb82fd 100644 --- a/lustre/include/lustre_import.h +++ b/lustre/include/lustre_import.h @@ -336,9 +336,11 @@ static inline unsigned int at_timeout2est(unsigned int val) } static inline void at_reset(struct adaptive_timeout *at, int val) { + spin_lock(&at->at_lock); at->at_current = val; at->at_worst_ever = val; at->at_worst_time = cfs_time_current_sec(); + spin_unlock(&at->at_lock); } static inline void at_init(struct adaptive_timeout *at, int val, int flags) { memset(at, 0, sizeof(*at));