From: Sam Lang Date: Sat, 23 Mar 2013 19:07:59 +0000 (-0500) Subject: client: don't set other if lookup fails in rename X-Git-Tag: v0.60~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ece4348807190870be5e484f5edbd1adfc6c1f5b;p=ceph.git client: don't set other if lookup fails in rename On rename, only set the other inode if the lookup for the destination succeeds, otherwise we hit a segv in set_other_inode(). Fixes #4517. Signed-off-by: Sam Lang Tested-by: Noah Watkins --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 792d4a2fdda..d1f8564aa8f 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -7340,10 +7340,12 @@ int Client::_rename(Inode *fromdir, const char *fromname, Inode *todir, const ch Inode *otherin; res = _lookup(todir, toname, &otherin); - if (res != 0 && res != -ENOENT) + if (res != 0 && res != -ENOENT) { goto fail; - req->set_other_inode(otherin); - req->other_inode_drop = CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL; + } else if (res == 0) { + req->set_other_inode(otherin); + req->other_inode_drop = CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL; + } req->set_inode(todir);