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 <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
This commit is contained in:
pete scott 2014-09-23 13:20:45 -06:00 committed by Jeffrey Altman
parent 5ebe2437ef
commit 06995ceb4d
2 changed files with 23 additions and 129 deletions

View File

@ -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,

View File

@ -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,