From f3f003b4095e1849b51a4fbd8d78e29749c6d569 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Thu, 6 Jun 2013 14:36:36 +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: 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 --- lustre/include/lustre_import.h | 2 ++ 1 file changed, 2 insertions(+) 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)); -- 1.8.3.1