mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 00:43:00 -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,
|
!MmFlushImageSection(&DescendantFileNode->NonPaged->SectionObjectPointers,
|
||||||
MmFlushForDelete)))
|
MmFlushForDelete)))
|
||||||
{
|
{
|
||||||
/* release the FileNode in case of failure! */
|
/* release the FileNode and rename lock in case of failure! */
|
||||||
FspFileNodeReleaseF(FileNode, AcquireFlags);
|
FspFileNodeReleaseF(FileNode, AcquireFlags);
|
||||||
|
FspFsvolDeviceFileRenameRelease(FsvolDeviceObject);
|
||||||
|
|
||||||
Result = STATUS_ACCESS_DENIED;
|
Result = STATUS_ACCESS_DENIED;
|
||||||
goto exit;
|
goto exit;
|
||||||
@ -1441,8 +1442,9 @@ NTSTATUS FspFileNodeRenameCheck(PDEVICE_OBJECT FsvolDeviceObject, PIRP OplockIrp
|
|||||||
|
|
||||||
if (STATUS_OPLOCK_BREAK_IN_PROGRESS == Result || !NT_SUCCESS(Result))
|
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);
|
FspFileNodeReleaseF(FileNode, AcquireFlags);
|
||||||
|
FspFsvolDeviceFileRenameRelease(FsvolDeviceObject);
|
||||||
|
|
||||||
/* wait for oplock breaks to finish */
|
/* wait for oplock breaks to finish */
|
||||||
for (
|
for (
|
||||||
@ -1488,8 +1490,9 @@ NTSTATUS FspFileNodeRenameCheck(PDEVICE_OBJECT FsvolDeviceObject, PIRP OplockIrp
|
|||||||
|
|
||||||
if (DescendantFileNode != FileNode && 0 < DescendantFileNode->HandleCount)
|
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);
|
FspFileNodeReleaseF(FileNode, AcquireFlags);
|
||||||
|
FspFsvolDeviceFileRenameRelease(FsvolDeviceObject);
|
||||||
|
|
||||||
Result = STATUS_ACCESS_DENIED;
|
Result = STATUS_ACCESS_DENIED;
|
||||||
break;
|
break;
|
||||||
|
@ -1576,8 +1576,8 @@ static NTSTATUS FspFsvolSetRenameInformation(
|
|||||||
ASSERT(TargetFileNode->IsDirectory);
|
ASSERT(TargetFileNode->IsDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
FspFsvolDeviceFileRenameAcquireExclusive(FsvolDeviceObject);
|
|
||||||
retry:
|
retry:
|
||||||
|
FspFsvolDeviceFileRenameAcquireExclusive(FsvolDeviceObject);
|
||||||
FspFileNodeAcquireExclusive(FileNode, Full);
|
FspFileNodeAcquireExclusive(FileNode, Full);
|
||||||
|
|
||||||
if (0 == Request)
|
if (0 == Request)
|
||||||
@ -1651,13 +1651,13 @@ retry:
|
|||||||
Result = FspFileNodeRenameCheck(FsvolDeviceObject, Irp,
|
Result = FspFileNodeRenameCheck(FsvolDeviceObject, Irp,
|
||||||
FileNode, FspFileNodeAcquireFull,
|
FileNode, FspFileNodeAcquireFull,
|
||||||
&FileNode->FileName, TRUE);
|
&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)
|
if (STATUS_OPLOCK_BREAK_IN_PROGRESS == Result)
|
||||||
goto retry;
|
goto retry;
|
||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
{
|
{
|
||||||
Result = STATUS_ACCESS_DENIED;
|
Result = STATUS_ACCESS_DENIED;
|
||||||
goto rename_unlock_exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 != FspFileNameCompare(&FileNode->FileName, &NewFileName, !FileDesc->CaseSensitive, 0))
|
if (0 != FspFileNameCompare(&FileNode->FileName, &NewFileName, !FileDesc->CaseSensitive, 0))
|
||||||
@ -1665,13 +1665,13 @@ retry:
|
|||||||
Result = FspFileNodeRenameCheck(FsvolDeviceObject, Irp,
|
Result = FspFileNodeRenameCheck(FsvolDeviceObject, Irp,
|
||||||
FileNode, FspFileNodeAcquireFull,
|
FileNode, FspFileNodeAcquireFull,
|
||||||
&NewFileName, FALSE);
|
&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)
|
if (STATUS_OPLOCK_BREAK_IN_PROGRESS == Result)
|
||||||
goto retry;
|
goto retry;
|
||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
{
|
{
|
||||||
Result = STATUS_ACCESS_DENIED;
|
Result = STATUS_ACCESS_DENIED;
|
||||||
goto rename_unlock_exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1713,9 +1713,9 @@ retry:
|
|||||||
|
|
||||||
unlock_exit:
|
unlock_exit:
|
||||||
FspFileNodeRelease(FileNode, Full);
|
FspFileNodeRelease(FileNode, Full);
|
||||||
rename_unlock_exit:
|
|
||||||
FspFsvolDeviceFileRenameRelease(FsvolDeviceObject);
|
FspFsvolDeviceFileRenameRelease(FsvolDeviceObject);
|
||||||
|
|
||||||
|
exit:
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user