]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
Client: mkdirs bugs when two clients send mkdir request for a same dir
authordongdong <tdd21151186@gmail.com>
Wed, 12 Jul 2017 03:30:32 +0000 (11:30 +0800)
committerdongdong <tdd21151186@gmail.com>
Wed, 12 Jul 2017 03:55:02 +0000 (11:55 +0800)
Fixes: http://tracker.ceph.com/issues/20592
Signed-off-by: dongdong tao <tdd21151186@gmail.com>
src/client/Client.cc

index d98b5f383457523c7a9e151756e031f742bd9713..adfd42cf8beea810225838f85ad05f4c02b71d3e 100644 (file)
@@ -6466,8 +6466,13 @@ int Client::mkdirs(const char *relpath, mode_t mode, const UserPerm& perms)
     }
     //make new dir
     r = _mkdir(cur.get(), path[i].c_str(), mode, perms, &next);
+    
     //check proper creation/existence
-    if (r < 0) return r;
+    if(-EEXIST == r && i < path.depth() - 1) {
+      r = _lookup(cur.get(), path[i].c_str(), CEPH_CAP_AUTH_SHARED, &next, perms);
+    }  
+    if (r < 0) 
+      return r;
     //move to new dir and continue
     cur.swap(next);
     ldout(cct, 20) << "mkdirs: successfully created directory "