From 3f7b411e1e304e8a6f295dc50b8cf3c6c496f4cc Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Tue, 21 Feb 2017 13:55:40 +0100 Subject: [PATCH] rgw_file.h: fix potential data race condition Fix for: CID 1399581 (#1 of 1): Data race condition (MISSING_LOCK) missing_lock: Accessing this->state.atime without holding lock rgw::RGWFileHandle.mtx. Elsewhere, "_ZN3rgw13RGWFileHandle5StateE.atime" is accessed with rgw::RGWFileHandle.mtx held 2 out of 3 times (2 of these accesses strongly imply that it is necessary). Signed-off-by: Danny Al-Gaaf --- src/rgw/rgw_file.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index 3d671a0dee2f8..42439bedf9548 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -534,6 +534,7 @@ namespace rgw { } void set_times(real_time t) { + lock_guard guard(mtx); state.ctime = real_clock::to_timespec(t); state.mtime = state.ctime; state.atime = state.ctime; -- 2.39.5