Windows: Media Protected if create on RO volume

If there is an attempt to create a file/directory on a readonly
volume as indicated by the Volume Characteristics, return
STATUS_MEDIA_WRITE_PROTECTED immediately.  Do not bother contacting
the afsd_service.

Change-Id: I809adacbbc429166d9a0e308752e484400799cb8
Reviewed-on: http://gerrit.openafs.org/7647
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
This commit is contained in:
Jeffrey Altman 2012-06-24 10:16:42 -04:00
parent 53413685ce
commit f3f282265a

View File

@ -688,6 +688,28 @@ AFSCommonCreate( IN PDEVICE_OBJECT DeviceObject,
pDirectoryCB == NULL))
{
if ( pVolumeCB &&
BooleanFlagOn( pVolumeCB->VolumeInformation.Characteristics, FILE_READ_ONLY_DEVICE))
{
AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
AFS_TRACE_LEVEL_VERBOSE,
"AFSCommonCreate ReadOnly Device on create Status %08lX\n",
ntStatus);
InterlockedDecrement( &pParentDirectoryCB->OpenReferenceCount);
AFSDbgLogMsg( AFS_SUBSYSTEM_DIRENTRY_REF_COUNTING,
AFS_TRACE_LEVEL_VERBOSE,
"AFSCommonCreate Decrement13 count on %wZ DE %p Ccb %p Cnt %d\n",
&pParentDirectoryCB->NameInformation.FileName,
pParentDirectoryCB,
NULL,
pParentDirectoryCB->OpenReferenceCount);
try_return( ntStatus = STATUS_MEDIA_WRITE_PROTECTED);
}
if( uniComponentName.Length == 0 ||
pDirectoryCB != NULL)
{