]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
client: fix simultaneous readdirs race 9655/head
authorYan, Zheng <zyan@redhat.com>
Mon, 9 May 2016 14:12:48 +0000 (22:12 +0800)
committerGreg Farnum <gfarnum@redhat.com>
Sun, 12 Jun 2016 21:10:32 +0000 (14:10 -0700)
commitd61e3ddf6d99a4b9b72fd769d635bf9b2bffaf0e
treef7d637fa8cedca8c6c0526a978b1dca0280b622f
parentba9fa11a235dc6c55b3b03e3a98b17316d06cf27
client: fix simultaneous readdirs race

Current readdir code uses list to track the order of the dentries
in readdir replies.  When handling a readdir reply, it pushes the
resulting dentries to the back of directory's dentry_list. After
readdir finishes, the dentry_list reflects how MDS sorts dentries.

This method is racy when there are simultaneous readdirs. The fix
is use vector instead of list to trace how dentries are sorted in
its parent directory. As long as shared_gen doesn't change, each
dentry is at fixed position of the vector. So cocurrent readdirs
do not affect each other.

Fixes: http://tracker.ceph.com/issues/15508
Signed-off-by: Yan, Zheng <zyan@redhat.com>
(cherry picked from commit 9d297c5e98f814b282dadc379ab70dfa678db73e)

Signed-off-by: Greg Farnum <gfarnum@redhat.com
src/client/Client.cc
src/client/Client.h
src/client/Dentry.h
src/client/Dir.h
src/client/Inode.h