From: Danny Al-Gaaf Date: Tue, 21 Feb 2017 12:55:40 +0000 (+0100) Subject: rgw_file.h: fix potential data race condition X-Git-Tag: v12.0.2~116^2~11 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3f7b411e1e304e8a6f295dc50b8cf3c6c496f4cc;p=ceph.git 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 --- 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;