ULONG ulAttributes = 0;
LARGE_INTEGER liAllocationSize = {0,0};
BOOLEAN bFileCreated = FALSE, bReleaseFcb = FALSE, bAllocatedCcb = FALSE;
- BOOLEAN bAllocatedFcb = FALSE;
PACCESS_MASK pDesiredAccess = NULL;
USHORT usShareAccess;
AFSDirectoryCB *pDirEntry = NULL;
// We may have raced and the Fcb is already created
//
- if( pObjectInfo->Fcb != NULL)
- {
+ //
+ // Allocate and initialize the Fcb for the file.
+ //
- AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
- AFS_TRACE_LEVEL_VERBOSE,
- "AFSProcessCreate (%08lX) Not allocating Fcb for file %wZ\n",
- Irp,
- FullFileName);
+ ntStatus = AFSInitFcb( pDirEntry);
- *Fcb = pObjectInfo->Fcb;
+ *Fcb = pObjectInfo->Fcb;
- AFSAcquireExcl( &(*Fcb)->NPFcb->Resource,
- TRUE);
- }
- else
+ if( !NT_SUCCESS( ntStatus))
{
- //
- // Allocate and initialize the Fcb for the file.
- //
-
- ntStatus = AFSInitFcb( pDirEntry);
-
- *Fcb = pObjectInfo->Fcb;
-
- if( !NT_SUCCESS( ntStatus))
- {
-
- AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
- AFS_TRACE_LEVEL_ERROR,
- "AFSProcessCreate (%08lX) Failed to initialize fcb %wZ Status %08lX\n",
- Irp,
- FullFileName,
- ntStatus);
-
- try_return( ntStatus);
- }
-
- if ( ntStatus != STATUS_REPARSE)
- {
-
- bAllocatedFcb = TRUE;
- }
+ AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+ AFS_TRACE_LEVEL_ERROR,
+ "AFSProcessCreate (%08lX) Failed to initialize fcb %wZ Status %08lX\n",
+ Irp,
+ FullFileName,
+ ntStatus);
- ntStatus = STATUS_SUCCESS;
+ try_return( ntStatus);
}
+ ntStatus = STATUS_SUCCESS;
+
//
// Increment the open count on this Fcb
//
*Ccb);
}
- if( bAllocatedFcb)
- {
-
- AFSAcquireExcl( &pObjectInfo->NonPagedInfo->ObjectInfoLock,
- TRUE);
-
- AFSRemoveFcb( &pObjectInfo->Fcb);
-
- AFSReleaseResource( &pObjectInfo->NonPagedInfo->ObjectInfoLock);
- }
+ //
+ // Fcb will be freed by AFSPrimaryVolumeWorker thread
+ //
*Fcb = NULL;
PACCESS_MASK pDesiredAccess = NULL;
USHORT usShareAccess;
BOOLEAN bAllocatedCcb = FALSE;
- BOOLEAN bReleaseFcb = FALSE, bAllocatedFcb = FALSE;
+ BOOLEAN bReleaseFcb = FALSE;
AFSObjectInfoCB *pParentObject = NULL, *pTargetObject = NULL;
UNICODE_STRING uniTargetName;
LONG lCount;
//
// Make sure we have an Fcb for the access
+
+ //
+ // Allocate and initialize the Fcb for the file.
//
- if( pParentObject->Fcb != NULL)
- {
+ ntStatus = AFSInitFcb( ParentDirectoryCB);
- *Fcb = pParentObject->Fcb;
+ *Fcb = pParentObject->Fcb;
- AFSAcquireExcl( &(*Fcb)->NPFcb->Resource,
- TRUE);
- }
- else
+ if( !NT_SUCCESS( ntStatus))
{
- //
- // Allocate and initialize the Fcb for the file.
- //
-
- ntStatus = AFSInitFcb( ParentDirectoryCB);
-
- *Fcb = pParentObject->Fcb;
-
- if( !NT_SUCCESS( ntStatus))
- {
-
- AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
- AFS_TRACE_LEVEL_ERROR,
- "AFSOpenTargetDirectory (%08lX) Failed to initialize fcb %wZ Status %08lX\n",
- Irp,
- &ParentDirectoryCB->NameInformation.FileName,
- ntStatus);
-
- try_return( ntStatus);
- }
-
- if ( ntStatus != STATUS_REPARSE)
- {
-
- bAllocatedFcb = TRUE;
- }
+ AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+ AFS_TRACE_LEVEL_ERROR,
+ "AFSOpenTargetDirectory (%08lX) Failed to initialize fcb %wZ Status %08lX\n",
+ Irp,
+ &ParentDirectoryCB->NameInformation.FileName,
+ ntStatus);
- ntStatus = STATUS_SUCCESS;
+ try_return( ntStatus);
}
+ ntStatus = STATUS_SUCCESS;
+
//
// Increment the open count on this Fcb
//
*Ccb = NULL;
- if( bAllocatedFcb)
- {
-
- AFSAcquireExcl( &pParentObject->NonPagedInfo->ObjectInfoLock,
- TRUE);
-
- AFSRemoveFcb( &pParentObject->Fcb);
-
- AFSReleaseResource( &pParentObject->NonPagedInfo->ObjectInfoLock);
- }
+ //
+ // Fcb will be freed by AFSPrimaryVolumeWorker thread
+ //
*Fcb = NULL;
}
PIO_STACK_LOCATION pIrpSp = IoGetCurrentIrpStackLocation( Irp);
PACCESS_MASK pDesiredAccess = NULL;
USHORT usShareAccess;
- BOOLEAN bAllocatedCcb = FALSE, bReleaseFcb = FALSE, bAllocatedFcb = FALSE;
+ BOOLEAN bAllocatedCcb = FALSE, bReleaseFcb = FALSE;
ULONG ulAdditionalFlags = 0, ulOptions = 0;
AFSFileOpenCB stOpenCB;
AFSFileOpenResultCB stOpenResultCB;
try_return( ntStatus);
}
- if ( ntStatus != STATUS_REPARSE)
- {
-
- bAllocatedFcb = TRUE;
- }
-
ntStatus = STATUS_SUCCESS;
//
*Ccb = NULL;
- if( bAllocatedFcb)
- {
-
- AFSAcquireExcl( &pObjectInfo->NonPagedInfo->ObjectInfoLock,
- TRUE);
-
- AFSRemoveFcb( &pObjectInfo->Fcb);
-
- AFSReleaseResource( &pObjectInfo->NonPagedInfo->ObjectInfoLock);
- }
+ //
+ // Fcb will be freed by AFSPrimaryVolumeWorker thread
+ //
*Fcb = NULL;
}
ULONG ulAttributes = 0;
LARGE_INTEGER liTime;
ULONG ulCreateDisposition = 0;
- BOOLEAN bAllocatedCcb = FALSE, bAllocatedFcb = FALSE;
+ BOOLEAN bAllocatedCcb = FALSE;
PACCESS_MASK pDesiredAccess = NULL;
USHORT usShareAccess;
AFSObjectInfoCB *pParentObjectInfo = NULL;
// Be sure we have an Fcb for the object block
//
- if( pObjectInfo->Fcb == NULL)
- {
-
- ntStatus = AFSInitFcb( DirectoryCB);
-
- *Fcb = pObjectInfo->Fcb;
-
- if( !NT_SUCCESS( ntStatus))
- {
-
- AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
- AFS_TRACE_LEVEL_ERROR,
- "AFSProcessOverwriteSupersede (%08lX) Failed to initialize fcb %wZ Status %08lX\n",
- Irp,
- &DirectoryCB->NameInformation.FileName,
- ntStatus);
+ ntStatus = AFSInitFcb( DirectoryCB);
- try_return( ntStatus);
- }
+ *Fcb = pObjectInfo->Fcb;
- if ( ntStatus != STATUS_REPARSE)
- {
+ if( !NT_SUCCESS( ntStatus))
+ {
- bAllocatedFcb = TRUE;
- }
+ AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+ AFS_TRACE_LEVEL_ERROR,
+ "AFSProcessOverwriteSupersede (%08lX) Failed to initialize fcb %wZ Status %08lX\n",
+ Irp,
+ &DirectoryCB->NameInformation.FileName,
+ ntStatus);
- ntStatus = STATUS_SUCCESS;
+ try_return( ntStatus);
}
- else
- {
- AFSAcquireExcl( pObjectInfo->Fcb->Header.Resource,
- TRUE);
- }
+ ntStatus = STATUS_SUCCESS;
//
// Increment the open count on this Fcb.
*Ccb = NULL;
- if( bAllocatedFcb)
- {
-
- AFSAcquireExcl( &pObjectInfo->NonPagedInfo->ObjectInfoLock,
- TRUE);
-
- AFSRemoveFcb( &pObjectInfo->Fcb);
-
- AFSReleaseResource( &pObjectInfo->NonPagedInfo->ObjectInfoLock);
- }
+ //
+ // Fcb will be freed by AFSPrimaryVolumeWorker thread
+ //
*Fcb = NULL;
}
NTSTATUS ntStatus = STATUS_SUCCESS;
PFILE_OBJECT pFileObject = NULL;
PIO_STACK_LOCATION pIrpSp = IoGetCurrentIrpStackLocation( Irp);
- BOOLEAN bReleaseFcb = FALSE, bAllocatedCcb = FALSE, bAllocatedFcb = FALSE;
+ BOOLEAN bReleaseFcb = FALSE, bAllocatedCcb = FALSE;
UNICODE_STRING uniFullFileName;
AFSPIOCtlOpenCloseRequestCB stPIOCtlOpen;
AFSFileID stFileID;
}
}
- if( pParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB->ObjectInformation->Fcb == NULL)
- {
-
- //
- // Allocate and initialize the Fcb for the file.
- //
-
- ntStatus = AFSInitFcb( pParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB);
-
- *Fcb = pParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB->ObjectInformation->Fcb;
-
- if( !NT_SUCCESS( ntStatus))
- {
-
- AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
- AFS_TRACE_LEVEL_ERROR,
- "AFSOpenIOCtlFcb (%08lX) Failed to initialize fcb Status %08lX\n",
- Irp,
- ntStatus);
-
- try_return( ntStatus);
- }
+ //
+ // Allocate and initialize the Fcb for the file.
+ //
- if ( ntStatus != STATUS_REPARSE)
- {
+ ntStatus = AFSInitFcb( pParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB);
- bAllocatedFcb = TRUE;
- }
+ *Fcb = pParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB->ObjectInformation->Fcb;
- ntStatus = STATUS_SUCCESS;
- }
- else
+ if( !NT_SUCCESS( ntStatus))
{
- *Fcb = pParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB->ObjectInformation->Fcb;
+ AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+ AFS_TRACE_LEVEL_ERROR,
+ "AFSOpenIOCtlFcb (%08lX) Failed to initialize fcb Status %08lX\n",
+ Irp,
+ ntStatus);
- AFSAcquireExcl( &(*Fcb)->NPFcb->Resource,
- TRUE);
+ try_return( ntStatus);
}
+ ntStatus = STATUS_SUCCESS;
+
//
// Increment the open reference and handle on the node
//
*Ccb = NULL;
- if( bAllocatedFcb)
- {
-
- //
- // Need to tear down this Fcb since it is not in the tree for the worker thread
- //
-
- AFSAcquireExcl( &pParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB->ObjectInformation->NonPagedInfo->ObjectInfoLock,
- TRUE);
-
- AFSRemoveFcb( &pParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB->ObjectInformation->Fcb);
-
- AFSReleaseResource( &pParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB->ObjectInformation->NonPagedInfo->ObjectInfoLock);
- }
+ //
+ // Fcb will be freed by AFSPrimaryVolumeWorker thread
+ //
*Fcb = NULL;
}