From 06995ceb4d664c3f14f6626da447cf9891470719 Mon Sep 17 00:00:00 2001 From: pete scott Date: Tue, 23 Sep 2014 13:20:45 -0600 Subject: [PATCH] Windows: !overwrite IOMgr populated FileInfo data I/O Manager will populate the FILE_ACCESS_INFORMATION, FILE_MODE_INFORMATION, and FILE_ALIGNMENT_INFORMATION portions of a FILE_ALL_INFORMATION structure prior to forwarding a FileAllInformation FileInfo query to the file system. There is no need for the file system to duplicate the effort. Change-Id: Iaa7f1de95c6b7e42bdc326cc3f4bfe8596add949 Reviewed-on: http://gerrit.openafs.org/11478 Reviewed-by: Peter Scott Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp | 134 +++--------------- .../afsrdr/kernel/lib/Include/AFSCommon.h | 18 --- 2 files changed, 23 insertions(+), 129 deletions(-) diff --git a/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp b/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp index 478d546746..c0645be9cb 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp @@ -245,17 +245,18 @@ AFSQueryFileInfo( IN PDEVICE_OBJECT LibDeviceObject, try_return( ntStatus); } - ntStatus = AFSQueryAccess( Irp, - pFcb, - &pAllInfo->AccessInformation, - &lLength); + // + // We skip setting AccessInformation since this is set by the IO Mgr prior + // to sending this request to the file system + // - if( !NT_SUCCESS( ntStatus)) + if( lLength < sizeof( FILE_ACCESS_INFORMATION)) { - - try_return( ntStatus); + try_return( ntStatus = STATUS_BUFFER_TOO_SMALL); } + lLength -= sizeof( FILE_ACCESS_INFORMATION); + ntStatus = AFSQueryPositionInfo( Irp, pFcb, &pAllInfo->PositionInformation, @@ -267,28 +268,29 @@ AFSQueryFileInfo( IN PDEVICE_OBJECT LibDeviceObject, try_return( ntStatus); } - ntStatus = AFSQueryMode( Irp, - pFcb, - &pAllInfo->ModeInformation, - &lLength); + // + // We skip setting ModeInformation and AlignmentInformation since this is set by the IO Mgr prior + // to sending this request to the file system + // - if( !NT_SUCCESS( ntStatus)) + if( lLength < sizeof( FILE_MODE_INFORMATION)) { - - try_return( ntStatus); + try_return( ntStatus = STATUS_BUFFER_TOO_SMALL); } - ntStatus = AFSQueryAlignment( Irp, - pFcb, - &pAllInfo->AlignmentInformation, - &lLength); + lLength -= sizeof( FILE_MODE_INFORMATION); - if( !NT_SUCCESS( ntStatus)) + if( lLength < sizeof( FILE_ALIGNMENT_INFORMATION)) { - - try_return( ntStatus); + try_return( ntStatus = STATUS_BUFFER_TOO_SMALL); } + lLength -= sizeof( FILE_ALIGNMENT_INFORMATION); + + // + // Populate the name information + // + ntStatus = AFSQueryNameInfo( Irp, pCcb->DirectoryCB, &pAllInfo->NameInformation, @@ -1125,96 +1127,6 @@ AFSQueryPositionInfo( IN PIRP Irp, return ntStatus; } -NTSTATUS -AFSQueryAccess( IN PIRP Irp, - IN AFSFcb *Fcb, - IN OUT PFILE_ACCESS_INFORMATION Buffer, - IN OUT PLONG Length) -{ - - UNREFERENCED_PARAMETER(Irp); - UNREFERENCED_PARAMETER(Fcb); - NTSTATUS ntStatus = STATUS_SUCCESS; - - if( *Length >= sizeof( FILE_ACCESS_INFORMATION)) - { - - RtlZeroMemory( Buffer, - *Length); - - Buffer->AccessFlags = 0; - - *Length -= sizeof( FILE_ACCESS_INFORMATION); - } - else - { - - ntStatus = STATUS_BUFFER_TOO_SMALL; - } - - return ntStatus; -} - -NTSTATUS -AFSQueryMode( IN PIRP Irp, - IN AFSFcb *Fcb, - IN OUT PFILE_MODE_INFORMATION Buffer, - IN OUT PLONG Length) -{ - - UNREFERENCED_PARAMETER(Irp); - UNREFERENCED_PARAMETER(Fcb); - NTSTATUS ntStatus = STATUS_SUCCESS; - - if( *Length >= sizeof( FILE_MODE_INFORMATION)) - { - - RtlZeroMemory( Buffer, - *Length); - - Buffer->Mode = 0; - - *Length -= sizeof( FILE_MODE_INFORMATION); - } - else - { - - ntStatus = STATUS_BUFFER_TOO_SMALL; - } - - return ntStatus; -} - -NTSTATUS -AFSQueryAlignment( IN PIRP Irp, - IN AFSFcb *Fcb, - IN OUT PFILE_ALIGNMENT_INFORMATION Buffer, - IN OUT PLONG Length) -{ - - UNREFERENCED_PARAMETER(Irp); - UNREFERENCED_PARAMETER(Fcb); - NTSTATUS ntStatus = STATUS_SUCCESS; - - if( *Length >= sizeof( FILE_ALIGNMENT_INFORMATION)) - { - - RtlZeroMemory( Buffer, - *Length); - - Buffer->AlignmentRequirement = 1; - - *Length -= sizeof( FILE_ALIGNMENT_INFORMATION); - } - else - { - - ntStatus = STATUS_BUFFER_TOO_SMALL; - } - - return ntStatus; -} - NTSTATUS AFSQueryNameInfo( IN PIRP Irp, IN AFSDirectoryCB *DirectoryCB, diff --git a/src/WINNT/afsrdr/kernel/lib/Include/AFSCommon.h b/src/WINNT/afsrdr/kernel/lib/Include/AFSCommon.h index f85396078f..55735e2126 100644 --- a/src/WINNT/afsrdr/kernel/lib/Include/AFSCommon.h +++ b/src/WINNT/afsrdr/kernel/lib/Include/AFSCommon.h @@ -797,24 +797,6 @@ AFSQueryStreamInfo( IN PIRP Irp, IN OUT FILE_STREAM_INFORMATION *Buffer, IN OUT PLONG Length); -NTSTATUS -AFSQueryAccess( IN PIRP Irp, - IN AFSFcb *Fcb, - IN OUT PFILE_ACCESS_INFORMATION Buffer, - IN OUT PLONG Length); - -NTSTATUS -AFSQueryMode( IN PIRP Irp, - IN AFSFcb *Fcb, - IN OUT PFILE_MODE_INFORMATION Buffer, - IN OUT PLONG Length); - -NTSTATUS -AFSQueryAlignment( IN PIRP Irp, - IN AFSFcb *Fcb, - IN OUT PFILE_ALIGNMENT_INFORMATION Buffer, - IN OUT PLONG Length); - NTSTATUS AFSQueryAttribTagInfo( IN PIRP Irp, IN AFSDirectoryCB *DirectoryCB,