If the old_dentry is in the same dir, and it is the last dentry, we need
to keep the dir open.
This is hard to hit because the rename itself will typically instantiate
a null dentry on the target, and it's hard to construct a working where
a racing process makes us drop it. Fortunately this was triggered
reliably by the snaptest-git-ceph.sh workunit.
Fixes: #1519
Signed-off-by: Sage Weil <sage@newdream.net>
if (!dn || dn->inode == 0) {
in->get();
if (old_dentry)
- unlink(old_dentry, false);
+ unlink(old_dentry, dir == old_dentry->dir); // keep dir open if its the same dir
dn = link(dir, dname, in, dn);
in->put();
if (set_offset) {