mirror of
https://github.com/ceph/ceph
synced 2025-03-09 01:38:58 +00:00
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 <sam.lang@inktank.com> Tested-by: Noah Watkins <jayhawk@cs.ucsc.edu>
This commit is contained in:
parent
8e6a970c45
commit
ece4348807
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user