Skip to content

Commit

Permalink
rgw_file.h: fix potential data race condition
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dalgaaf authored and tchaikov committed Apr 10, 2017
1 parent d6b4ff0 commit 3f7b411
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/rgw/rgw_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3f7b411

Please sign in to comment.