From: Gui Hecheng Date: Sat, 27 May 2017 02:03:59 +0000 (+0800) Subject: rgw_file: add lock protection for readdir against gc X-Git-Tag: ses5-milestone6~9^2~49^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F15329%2Fhead;p=ceph.git rgw_file: add lock protection for readdir against gc The state.mtx protects state.events accessed both from readdir and gc. Fixes: http://tracker.ceph.com/issues/20121 Signed-off-by: Gui Hecheng --- diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index cd497480f474..136bed6452e0 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -1012,6 +1012,7 @@ namespace rgw { inc_nlink(req.d_count); *eof = req.eof(); event ev(event::type::READDIR, get_key(), state.atime); + lock_guard sguard(fs->state.mtx); fs->state.push_event(ev); } } else { @@ -1026,6 +1027,7 @@ namespace rgw { inc_nlink(req.d_count); *eof = req.eof(); event ev(event::type::READDIR, get_key(), state.atime); + lock_guard sguard(fs->state.mtx); fs->state.push_event(ev); } }