From: dongdong Date: Wed, 12 Jul 2017 03:30:32 +0000 (+0800) Subject: Client: mkdirs bugs when two clients send mkdir request for a same dir X-Git-Tag: v12.1.2~172^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=80bdd3fb4afd262ee3073b4e8377da9238bdaef2;p=ceph-ci.git Client: mkdirs bugs when two clients send mkdir request for a same dir Fixes: http://tracker.ceph.com/issues/20592 Signed-off-by: dongdong tao --- diff --git a/src/client/Client.cc b/src/client/Client.cc index d98b5f38345..adfd42cf8be 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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 "