]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix readdir vs fragmentation race 11147/head
authorYan, Zheng <zyan@redhat.com>
Tue, 20 Sep 2016 10:07:56 +0000 (18:07 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 20 Sep 2016 10:18:44 +0000 (18:18 +0800)
following sequence of events tigger the race

client readdir frag 0* -> got item 'A'
MDS merges frag 0* and frag 1*
client send readdir request (frag 1*, offset 2, readdir_start 'A')
MDS reply items (that are after item 'A') in frag *

Fixes: http://tracker.ceph.com/issues/17286
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/client/Client.cc

index 7b19a2a0482dc33ee1a5b13c0f25b9b348538ca2..530589c607626d11460a389fcecbd455f7203fc3 100644 (file)
@@ -1129,7 +1129,7 @@ void Client::insert_readdir_results(MetaRequest *request, MetaSession *session,
                   << ", readdir_start " << readdir_start << dendl;
 
     if (diri->snapid != CEPH_SNAPDIR &&
-       fg.is_leftmost() && readdir_offset == 2) {
+       fg.is_leftmost() && readdir_offset == 2 && readdir_start.empty()) {
       dirp->release_count = diri->dir_release_count;
       dirp->ordered_count = diri->dir_ordered_count;
       dirp->start_shared_gen = diri->shared_gen;