]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: Fix rename returning ENOENT for dest
authorSam Lang <sam.lang@inktank.com>
Fri, 22 Mar 2013 20:02:58 +0000 (15:02 -0500)
committerSage Weil <sage@inktank.com>
Sat, 23 Mar 2013 18:01:50 +0000 (11:01 -0700)
Introduced by fc80c1dc6ee315ae5e039986602ffadba46cb43b,
the client should _not_ fail if the lookup for the
destination path on rename returns ENOENT.

The previous code also did not check that the lookup
returned ENOENT or success.  We add the check and fail
if we get any other errors.

Fixes #4517.
Signed-off-by: Sam Lang <sam.lang@inktank.com>
src/client/Client.cc

index b49fe150c9dc54985e937cb98f6c132e6b7ce1ce..792d4a2fdda7074d6f8e8f061122fbd06f2c6288 100644 (file)
@@ -7340,7 +7340,7 @@ int Client::_rename(Inode *fromdir, const char *fromname, Inode *todir, const ch
 
   Inode *otherin;
   res = _lookup(todir, toname, &otherin);
-  if (res < 0)
+  if (res != 0 && res != -ENOENT)
     goto fail;
   req->set_other_inode(otherin);
   req->other_inode_drop = CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL;