]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
client: fix simultaneous readdirs race 8739/head
authorYan, Zheng <zyan@redhat.com>
Mon, 9 May 2016 14:12:48 +0000 (22:12 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 23 May 2016 08:23:38 +0000 (16:23 +0800)
commit9d297c5e98f814b282dadc379ab70dfa678db73e
treea61470940cb900aa43b1ce3ec6a17a4e411fff20
parent235fcf68f5d96a4d9d6cc260d12da912fa7ea4a8
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>
src/client/Client.cc
src/client/Client.h
src/client/Dentry.h
src/client/Dir.h
src/client/Inode.h