nfs4: Avoid deleting nodes when unlinking
* Stop deleting Inode objects in VnodeToInode::Unlink(). * Allow ~VnodeToInode() to do this in nfs4_remove_vnode(), instead. At the time the unlink hook is called, other threads could still have the file open. With this change, the nfs4 driver can pass the open/unlink test in the Connectathon NFS testsuite. Change-Id: I6e4f67fbafad73dd2eeb285dbd2b9fa9670bf5b5 Reviewed-on: https://review.haiku-os.org/c/haiku/+/9282 Tested-by: Commit checker robot <[email protected]> Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -39,13 +39,8 @@ VnodeToInode::Unlink(InodeNames* parent, const char* name)
|
|||||||
{
|
{
|
||||||
WriteLocker _(fLock);
|
WriteLocker _(fLock);
|
||||||
if (fInode != NULL && !IsRoot()) {
|
if (fInode != NULL && !IsRoot()) {
|
||||||
bool removed = fInode->GetFileSystem()->InoIdMap()->RemoveName(fID,
|
return fInode->GetFileSystem()->InoIdMap()->RemoveName(fID, parent,
|
||||||
parent, name);
|
name);
|
||||||
if (removed) {
|
|
||||||
delete fInode;
|
|
||||||
fInode = NULL;
|
|
||||||
}
|
|
||||||
return removed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -341,13 +341,10 @@ nfs4_remove_vnode(fs_volume* volume, fs_vnode* vnode, bool reenter)
|
|||||||
if (node == fs->Root())
|
if (node == fs->Root())
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
if (node != NULL && node->IsStale()) {
|
// Verify that all known names have been unlinked.
|
||||||
// in the case of a stale node, VnodeToInode::Unlink was never called by the client,
|
FileInfo fileInfo;
|
||||||
// so the Inode hasn't been deleted yet
|
ASSERT(fs->InoIdMap()->GetFileInfo(&fileInfo, vti->ID()) == B_ENTRY_NOT_FOUND);
|
||||||
vti->Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT(vti->GetPointer() == NULL);
|
|
||||||
delete vti;
|
delete vti;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user