From 8e6a970c45d7c70f746cc09d7699c9654d5e7862 Mon Sep 17 00:00:00 2001 From: Sam Lang Date: Fri, 22 Mar 2013 15:02:58 -0500 Subject: [PATCH] client: Fix rename returning ENOENT for dest 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 --- src/client/Client.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index b49fe150c9dc5..792d4a2fdda70 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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; -- 2.39.5