// Allocate and initialize the Fcb for the file.
//
- ntStatus = AFSInitFcb( pDirEntry,
- Fcb);
+ ntStatus = AFSInitFcb( pDirEntry);
- if( !NT_SUCCESS( ntStatus))
+ *Fcb = pObjectInfo->Fcb;
+
+ if( !NT_SUCCESS( ntStatus) &&
+ ntStatus != STATUS_REPARSE)
{
AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
try_return( ntStatus);
}
- bAllocatedFcb = TRUE;
+ if ( ntStatus != STATUS_REPARSE)
+ {
+
+ bAllocatedFcb = TRUE;
+ }
+
+ ntStatus = STATUS_SUCCESS;
}
bReleaseFcb = TRUE;
// Allocate and initialize the Fcb for the file.
//
- ntStatus = AFSInitFcb( ParentDirectoryCB,
- Fcb);
+ ntStatus = AFSInitFcb( ParentDirectoryCB);
- if( !NT_SUCCESS( ntStatus))
+ *Fcb = pParentObject->Fcb;
+
+ if( !NT_SUCCESS( ntStatus) &&
+ ntStatus != STATUS_REPARSE)
{
AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
try_return( ntStatus);
}
- bAllocatedFcb = TRUE;
+ if ( ntStatus == STATUS_REPARSE)
+ {
+
+ bAllocatedFcb = TRUE;
+ }
+
+ ntStatus = STATUS_SUCCESS;
}
bReleaseFcb = TRUE;
if( pObjectInfo->Fcb == NULL)
{
- ntStatus = AFSInitFcb( DirectoryCB,
- &pObjectInfo->Fcb);
+ ntStatus = AFSInitFcb( DirectoryCB);
- if( !NT_SUCCESS( ntStatus))
+ if( !NT_SUCCESS( ntStatus) &&
+ ntStatus != STATUS_REPARSE)
{
AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
try_return( ntStatus);
}
- bAllocatedFcb = TRUE;
+ if ( ntStatus != STATUS_REPARSE)
+ {
+
+ bAllocatedFcb = TRUE;
+ }
+
+ ntStatus = STATUS_SUCCESS;
}
else
{
if( pObjectInfo->Fcb == NULL)
{
- ntStatus = AFSInitFcb( DirectoryCB,
- Fcb);
+ ntStatus = AFSInitFcb( DirectoryCB);
- if( !NT_SUCCESS( ntStatus))
+ *Fcb = pObjectInfo->Fcb;
+
+ if( !NT_SUCCESS( ntStatus) &&
+ ntStatus != STATUS_REPARSE)
{
AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
try_return( ntStatus);
}
- bAllocatedFcb = TRUE;
+ if ( ntStatus != STATUS_REPARSE)
+ {
+
+ bAllocatedFcb = TRUE;
+ }
+
+ ntStatus = STATUS_SUCCESS;
}
else
{
// Allocate and initialize the Fcb for the file.
//
- ntStatus = AFSInitFcb( pParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB,
- Fcb);
+ ntStatus = AFSInitFcb( pParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB);
- if( !NT_SUCCESS( ntStatus))
+ *Fcb = pParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB->ObjectInformation->Fcb;
+
+ if( !NT_SUCCESS( ntStatus) &&
+ ntStatus != STATUS_REPARSE)
{
AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
try_return( ntStatus);
}
- bAllocatedFcb = TRUE;
+ if ( ntStatus != STATUS_REPARSE)
+ {
+
+ bAllocatedFcb = TRUE;
+ }
+
+ ntStatus = STATUS_SUCCESS;
}
else
{
// Allocate and initialize the Fcb for the file.
//
- ntStatus = AFSInitFcb( DirectoryCB,
- Fcb);
+ ntStatus = AFSInitFcb( DirectoryCB);
- if( !NT_SUCCESS( ntStatus))
+ *Fcb = DirectoryCB->ObjectInformation->Fcb;
+
+ if( !NT_SUCCESS( ntStatus) &&
+ ntStatus != STATUS_REPARSE)
{
AFSDbgLogMsg( AFS_SUBSYSTEM_PIPE_PROCESSING,
try_return( ntStatus);
}
- bAllocateFcb = TRUE;
+ if ( ntStatus != STATUS_REPARSE)
+ {
+
+ bAllocateFcb = TRUE;
+ }
+
+ ntStatus = STATUS_SUCCESS;
}
else
{
//
NTSTATUS
-AFSInitFcb( IN AFSDirectoryCB *DirEntry,
- IN OUT AFSFcb **Fcb)
+AFSInitFcb( IN AFSDirectoryCB *DirEntry)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
sizeof( AFSNonPagedFcb));
pNPFcb->Size = sizeof( AFSNonPagedFcb);
+
pNPFcb->Type = AFS_NON_PAGED_FCB;
//
pFcb->NPFcb = pNPFcb;
//
- // Initialize some fields in the Fcb
- //
-
- pFcb->ObjectInformation = pObjectInfo;
-
- pObjectInfo->Fcb = pFcb;
-
- //
// Set type specific information
//
}
//
- // And return the Fcb
+ // Initialize some fields in the Fcb
//
- *Fcb = pFcb;
+ if ( InterlockedCompareExchangePointer( (PVOID *)&pObjectInfo->Fcb, pFcb, NULL) != NULL)
+ {
+
+ AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+ AFS_TRACE_LEVEL_WARNING,
+ "AFSInitFcb Raced Fcb %08lX pFcb %08lX Name %wZ\n",
+ pObjectInfo->Fcb,
+ pFcb,
+ &DirEntry->NameInformation.FileName);
+
+ AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
+ AFS_TRACE_LEVEL_VERBOSE,
+ "AFSInitFcb Acquiring Fcb lock %08lX EXCL %08lX\n",
+ &pObjectInfo->Fcb->NPFcb->Resource,
+ PsGetCurrentThread());
+
+ AFSAcquireExcl( &pObjectInfo->Fcb->NPFcb->Resource,
+ TRUE);
+
+ try_return( ntStatus = STATUS_REPARSE);
+ }
+
+ pFcb->ObjectInformation = pObjectInfo;
AFSDbgLogMsg( AFS_SUBSYSTEM_FCB_REF_COUNTING,
AFS_TRACE_LEVEL_VERBOSE,
"AFSInitFcb Initialized Fcb %08lX Name %wZ\n",
- pFcb,
+ &pObjectInfo->Fcb,
&DirEntry->NameInformation.FileName);
try_exit:
- if( !NT_SUCCESS( ntStatus))
+ if( ntStatus != STATUS_SUCCESS)
{
- AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
- AFS_TRACE_LEVEL_ERROR,
- "AFSInitFcb Failed to initialize fcb Status %08lX\n",
- ntStatus);
+ if ( !NT_SUCCESS( ntStatus))
+ {
+
+ AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+ AFS_TRACE_LEVEL_ERROR,
+ "AFSInitFcb Failed to initialize fcb Status %08lX\n",
+ ntStatus);
+ }
if( pFcb != NULL)
{
AFSExFreePool( pNPFcb);
}
-
- if( Fcb != NULL)
- {
-
- *Fcb = NULL;
- }
}
}