sys: FspFsvolSetRenameInformation: when doing an exact case rename do not send it to the user mode file system

This commit is contained in:
Bill Zissimopoulos 2016-10-19 16:15:23 -07:00
parent 2ff60e5e98
commit 03611b6210
2 changed files with 17 additions and 1 deletions

View File

@ -1189,7 +1189,6 @@ static NTSTATUS FspFsvolSetRenameInformation(
* - A directory cannot be renamed if it or any of its subdirectories contains a file * - A directory cannot be renamed if it or any of its subdirectories contains a file
* that has open handles (except in the batch-oplock case described earlier). * that has open handles (except in the batch-oplock case described earlier).
*/ */
Result = STATUS_SUCCESS; Result = STATUS_SUCCESS;
FspFsvolDeviceLockContextTable(FsvolDeviceObject); FspFsvolDeviceLockContextTable(FsvolDeviceObject);
if (1 < FileNode->HandleCount || if (1 < FileNode->HandleCount ||
@ -1201,6 +1200,17 @@ static NTSTATUS FspFsvolSetRenameInformation(
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
return Result; return Result;
/*
* If the new file name is *exactly* the same (including case) as the old one,
* there is no need to go to the user mode file system. Just return STATUS_SUCCESS.
* Our RequestFini will do any cleanup necessary.
*
* This check needs to be done *after* the open handle test above. This is what FASTFAT
* and NTFS do.
*/
if (0 == FspFileNameCompare(&FileNode->FileName, &NewFileName, FALSE, 0))
return STATUS_SUCCESS;
return FSP_STATUS_IOQ_POST; return FSP_STATUS_IOQ_POST;
unlock_exit: unlock_exit:

View File

@ -568,6 +568,9 @@ static void rename_caseins_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeo
Success = CreateDirectoryW(Dir1Path, 0); Success = CreateDirectoryW(Dir1Path, 0);
ASSERT(Success); ASSERT(Success);
Success = MoveFileExW(Dir1Path, Dir1Path, 0);
ASSERT(Success);
Success = MoveFileExW(Dir1Path, Dir2Path, 0); Success = MoveFileExW(Dir1Path, Dir2Path, 0);
ASSERT(Success); ASSERT(Success);
@ -580,6 +583,9 @@ static void rename_caseins_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeo
ASSERT(INVALID_HANDLE_VALUE != Handle); ASSERT(INVALID_HANDLE_VALUE != Handle);
CloseHandle(Handle); CloseHandle(Handle);
Success = MoveFileExW(File1Path, File1Path, 0);
ASSERT(Success);
Success = MoveFileExW(File1Path, File2Path, 0); Success = MoveFileExW(File1Path, File2Path, 0);
ASSERT(Success); ASSERT(Success);