]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_file: add lock protection for readdir against gc 15329/head
authorGui Hecheng <guihecheng@cmss.chinamobile.com>
Sat, 27 May 2017 02:03:59 +0000 (10:03 +0800)
committerGui Hecheng <guihecheng@cmss.chinamobile.com>
Wed, 31 May 2017 09:29:52 +0000 (17:29 +0800)
The state.mtx protects state.events accessed both from readdir and gc.
Fixes: http://tracker.ceph.com/issues/20121
Signed-off-by: Gui Hecheng <guihecheng@cmss.chinamobile.com>
src/rgw/rgw_file.cc

index cd497480f47440f06cab5b38db23e378c4685f4a..136bed6452e0c8ed2345cd9642f4d82cda39c196 100644 (file)
@@ -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);
       }
     }