mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
sys: release rename lock when doing oplock breaks
This commit is contained in:
parent
39aad2b4fa
commit
b18df6bba8
@ -1337,8 +1337,9 @@ NTSTATUS FspFileNodeRenameCheck(PDEVICE_OBJECT FsvolDeviceObject, PIRP OplockIrp
|
||||
!MmFlushImageSection(&DescendantFileNode->NonPaged->SectionObjectPointers,
|
||||
MmFlushForDelete)))
|
||||
{
|
||||
/* release the FileNode in case of failure! */
|
||||
/* release the FileNode and rename lock in case of failure! */
|
||||
FspFileNodeReleaseF(FileNode, AcquireFlags);
|
||||
FspFsvolDeviceFileRenameRelease(FsvolDeviceObject);
|
||||
|
||||
Result = STATUS_ACCESS_DENIED;
|
||||
goto exit;
|
||||
@ -1441,8 +1442,9 @@ NTSTATUS FspFileNodeRenameCheck(PDEVICE_OBJECT FsvolDeviceObject, PIRP OplockIrp
|
||||
|
||||
if (STATUS_OPLOCK_BREAK_IN_PROGRESS == Result || !NT_SUCCESS(Result))
|
||||
{
|
||||
/* release the FileNode so that we can safely wait without deadlocks */
|
||||
/* release the FileNode and rename lock so that we can safely wait without deadlocks */
|
||||
FspFileNodeReleaseF(FileNode, AcquireFlags);
|
||||
FspFsvolDeviceFileRenameRelease(FsvolDeviceObject);
|
||||
|
||||
/* wait for oplock breaks to finish */
|
||||
for (
|
||||
@ -1488,8 +1490,9 @@ NTSTATUS FspFileNodeRenameCheck(PDEVICE_OBJECT FsvolDeviceObject, PIRP OplockIrp
|
||||
|
||||
if (DescendantFileNode != FileNode && 0 < DescendantFileNode->HandleCount)
|
||||
{
|
||||
/* release the FileNode in case of failure! */
|
||||
/* release the FileNode and rename lock in case of failure! */
|
||||
FspFileNodeReleaseF(FileNode, AcquireFlags);
|
||||
FspFsvolDeviceFileRenameRelease(FsvolDeviceObject);
|
||||
|
||||
Result = STATUS_ACCESS_DENIED;
|
||||
break;
|
||||
|
@ -1576,8 +1576,8 @@ static NTSTATUS FspFsvolSetRenameInformation(
|
||||
ASSERT(TargetFileNode->IsDirectory);
|
||||
}
|
||||
|
||||
FspFsvolDeviceFileRenameAcquireExclusive(FsvolDeviceObject);
|
||||
retry:
|
||||
FspFsvolDeviceFileRenameAcquireExclusive(FsvolDeviceObject);
|
||||
FspFileNodeAcquireExclusive(FileNode, Full);
|
||||
|
||||
if (0 == Request)
|
||||
@ -1651,13 +1651,13 @@ retry:
|
||||
Result = FspFileNodeRenameCheck(FsvolDeviceObject, Irp,
|
||||
FileNode, FspFileNodeAcquireFull,
|
||||
&FileNode->FileName, TRUE);
|
||||
/* FspFileNodeRenameCheck releases FileNode with STATUS_OPLOCK_BREAK_IN_PROGRESS or failure */
|
||||
/* FspFileNodeRenameCheck releases FileNode and rename lock on failure */
|
||||
if (STATUS_OPLOCK_BREAK_IN_PROGRESS == Result)
|
||||
goto retry;
|
||||
if (!NT_SUCCESS(Result))
|
||||
{
|
||||
Result = STATUS_ACCESS_DENIED;
|
||||
goto rename_unlock_exit;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (0 != FspFileNameCompare(&FileNode->FileName, &NewFileName, !FileDesc->CaseSensitive, 0))
|
||||
@ -1665,13 +1665,13 @@ retry:
|
||||
Result = FspFileNodeRenameCheck(FsvolDeviceObject, Irp,
|
||||
FileNode, FspFileNodeAcquireFull,
|
||||
&NewFileName, FALSE);
|
||||
/* FspFileNodeRenameCheck releases FileNode with STATUS_OPLOCK_BREAK_IN_PROGRESS or failure */
|
||||
/* FspFileNodeRenameCheck releases FileNode and rename lock on failure */
|
||||
if (STATUS_OPLOCK_BREAK_IN_PROGRESS == Result)
|
||||
goto retry;
|
||||
if (!NT_SUCCESS(Result))
|
||||
{
|
||||
Result = STATUS_ACCESS_DENIED;
|
||||
goto rename_unlock_exit;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1713,9 +1713,9 @@ retry:
|
||||
|
||||
unlock_exit:
|
||||
FspFileNodeRelease(FileNode, Full);
|
||||
rename_unlock_exit:
|
||||
FspFsvolDeviceFileRenameRelease(FsvolDeviceObject);
|
||||
|
||||
exit:
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user