Commit a2fb0c98 authored by Phoebe Buckheister's avatar Phoebe Buckheister 🦎 Committed by Christian Mohrbacher

client: let lookup_slow properly dispose of old dentries for us

instead of dropping dentries that are no longer valid ourselves, we are
better off letting lookup_slow doing that. handing off this
responsibility also fixes a case of mountpoints not going away for
directories that have been deleted by another clients.

(cherry picked from commit 01871e492eb83023affa9b03faa0c46683481d0e)
parent 821b4e64
......@@ -79,18 +79,7 @@ int FhgfsOps_revalidateIntent(struct dentry* dentry, unsigned flags)
FhgfsOpsHelper_logOp(Log_SPAM, app, dentry, inode, logContext);
if(!inode || !parentInode || is_bad_inode(inode) )
{
if(inode && S_ISDIR(inode->i_mode) )
{
if(have_submounts(dentry) )
goto cleanup_put_parent;
shrink_dcache_parent(dentry);
}
d_drop(dentry);
goto cleanup_put_parent;
}
// active dentry => remote-stat and local-compare
......@@ -132,8 +121,6 @@ int __FhgfsOps_revalidateIntent(struct dentry* parentDentry, struct dentry* dent
FhgfsInode* fhgfsInode = BEEGFS_INODE(inode);
bool cacheValid = FhgfsInode_isCacheValid(fhgfsInode, inode->i_mode, cfg);
int isValid = 0; // quasi-boolean (return value)
bool needDrop = false;
FhgfsIsizeHints iSizeHints;
......@@ -142,10 +129,7 @@ int __FhgfsOps_revalidateIntent(struct dentry* parentDentry, struct dentry* dent
if (cacheValid)
{
isValid = 1;
return isValid;
}
return 1;
if(IS_ROOT(dentry) )
fhgfsStatPtr = NULL;
......@@ -181,10 +165,7 @@ int __FhgfsOps_revalidateIntent(struct dentry* parentDentry, struct dentry* dent
FhgfsInode_entryInfoReadUnlock(parentFhgfsInode); // UNLOCK parentInfo
if (unlikely(remotingRes != FhgfsOpsErr_SUCCESS) )
{
needDrop = true;
goto out;
}
return 0;
if (outInfo.revalidateRes != FhgfsOpsErr_SUCCESS)
{
......@@ -192,8 +173,7 @@ int __FhgfsOps_revalidateIntent(struct dentry* parentDentry, struct dentry* dent
Logger_logErrFormatted(log, logContext, "Unexpected revalidate info missing: %s",
entryInfo->fileName);
needDrop = true;
goto out;
return 0;
}
// check the stat result here and set fhgfsStatPtr accordingly
......@@ -209,21 +189,11 @@ int __FhgfsOps_revalidateIntent(struct dentry* parentDentry, struct dentry* dent
entryInfo->fileName);
// now its getting difficult as there is an unexpected error
needDrop = true;
goto out;
return 0;
}
}
if (!__FhgfsOps_refreshInode(app, inode, fhgfsStatPtr, &iSizeHints) )
isValid = 1;
else
isValid = 0;
out:
if (needDrop)
d_drop(dentry);
return isValid;
return !__FhgfsOps_refreshInode(app, inode, fhgfsStatPtr, &iSizeHints);
}
/**
......
mount0 = node.properties["client0"]["mount"]
mount1 = node.properties["client1"]["mount"]
on node do
cd mount0 do
shell "mkdir a"
shell "sudo mount -t tmpfs 66144c9bbabe13ecd8b5a43dfdee150a44ef6edc a"
end
cd mount1 do
shell "while ! stat a >/dev/null 2>&1; do sleep 0.1; done"
shell "rmdir a"
end
cd mount0 do
# need to stat the directory to cause d_revalidate. unmount will work too.
# stat must fail at some point, because the directory is gone.
shell "while stat a >/dev/null 2>&1; do sleep 0.1; done"
shell "! mount | grep 66144c9bbabe13ecd8b5a43dfdee150a44ef6edc"
end
end
# vim:ft=ruby
desc:
check that mounts are removed properly when their mountpoints are removed by a peer.
hosts:
node: [mgmtd, meta, storage, helperd, client, client]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment