/*
- * Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC.
- * Copyright (c) 2009, 2010, 2011 Your File System, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Kernel Drivers, LLC.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013 Your File System, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
- * notice,
- * this list of conditions and the following disclaimer in the
- * documentation
- * and/or other materials provided with the distribution.
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
* - Neither the names of Kernel Drivers, LLC and Your File System, Inc.
* nor the names of their contributors may be used to endorse or promote
* products derived from this software without specific prior written
pCcb = (AFSCcb *)pIrpSp->FileObject->FsContext2;
+ pIrpSp->FileObject->FsContext2 = NULL;
+
//
// Send the close to the CM
//
{
pParentObjectInfo = AFSFindObjectInfo( pObjectInfo->VolumeCB,
- &pObjectInfo->ParentFileId);
+ &pObjectInfo->ParentFileId,
+ FALSE);
}
if( pParentObjectInfo != NULL &&
AFSReleaseResource( &pFcb->NPFcb->Resource);
+ pIrpSp->FileObject->FsContext = NULL;
+
lCount = InterlockedDecrement( &pFcb->OpenReferenceCount);
AFSDbgTrace(( AFS_SUBSYSTEM_FCB_REF_COUNTING,
pCcb = (AFSCcb *)pIrpSp->FileObject->FsContext2;
+ pIrpSp->FileObject->FsContext2;
+
//
// Remove the Ccb and de-allocate it
//
AFSReleaseResource( &pFcb->NPFcb->Resource);
+ pIrpSp->FileObject->FsContext = NULL;
+
lCount = InterlockedDecrement( &pFcb->OpenReferenceCount);
AFSDbgTrace(( AFS_SUBSYSTEM_FCB_REF_COUNTING,
pCcb = (AFSCcb *)pIrpSp->FileObject->FsContext2;
+ pIrpSp->FileObject->FsContext2 = NULL;
+
//
// We may be performing some cleanup on the Fcb so grab it exclusive to ensure no collisions
//
SetFlag( pFcb->Flags, AFS_FCB_FILE_CLOSED);
- //
- // Attempt to tear down our extent list for the file
- // If there are remaining dirty extents then attempt to
- // flush them as well
- //
+ if( !BooleanFlagOn( pDeviceExt->DeviceFlags, AFS_DEVICE_FLAG_DIRECT_SERVICE_IO))
+ {
- if( pFcb->Specific.File.ExtentsDirtyCount)
- {
+ //
+ // Attempt to tear down our extent list for the file
+ // If there are remaining dirty extents then attempt to
+ // flush them as well
+ //
- AFSFlushExtents( pFcb,
- &pCcb->AuthGroup);
- }
+ if( pFcb->Specific.File.ExtentsDirtyCount)
+ {
- //
- // Wait for any outstanding queued flushes to complete
- //
+ AFSFlushExtents( pFcb,
+ &pCcb->AuthGroup);
+ }
- AFSWaitOnQueuedFlushes( pFcb);
+ //
+ // Wait for any outstanding queued flushes to complete
+ //
- ASSERT( pFcb->Specific.File.ExtentsDirtyCount == 0 &&
- pFcb->Specific.File.QueuedFlushCount == 0);
+ AFSWaitOnQueuedFlushes( pFcb);
- AFSReleaseResource( &pFcb->NPFcb->Resource);
+ ASSERT( pFcb->Specific.File.ExtentsDirtyCount == 0 &&
+ pFcb->Specific.File.QueuedFlushCount == 0);
- //
- // Tear 'em down, we'll not be needing them again
- //
+ AFSReleaseResource( &pFcb->NPFcb->Resource);
- AFSTearDownFcbExtents( pFcb,
- &pCcb->AuthGroup);
- }
- else
- {
+ //
+ // Tear 'em down, we'll not be needing them again
+ //
- if( pFcb->Header.NodeTypeCode == AFS_FILE_FCB &&
- pFcb->Specific.File.ExtentsDirtyCount &&
- (pCcb->GrantedAccess & FILE_WRITE_DATA))
- {
+ AFSTearDownFcbExtents( pFcb,
+ &pCcb->AuthGroup);
+ }
+ else
+ {
- AFSFlushExtents( pFcb,
- &pCcb->AuthGroup);
- }
+ if( pFcb->Header.NodeTypeCode == AFS_FILE_FCB &&
+ pFcb->Specific.File.ExtentsDirtyCount &&
+ (pCcb->GrantedAccess & FILE_WRITE_DATA))
+ {
- AFSReleaseResource( &pFcb->NPFcb->Resource);
- }
+ AFSFlushExtents( pFcb,
+ &pCcb->AuthGroup);
+ }
+
+ AFSReleaseResource( &pFcb->NPFcb->Resource);
+ }
+ }
+ else
+ {
+
+ AFSReleaseResource( &pFcb->NPFcb->Resource);
+ }
pDirCB = pCcb->DirectoryCB;
{
pParentObjectInfo = AFSFindObjectInfo( pObjectInfo->VolumeCB,
- &pObjectInfo->ParentFileId);
+ &pObjectInfo->ParentFileId,
+ FALSE);
}
//
//
AFSDeleteDirEntry( pParentObjectInfo,
- pDirCB);
+ &pDirCB);
AFSAcquireShared( &pObjectInfo->NonPagedInfo->ObjectInfoLock,
TRUE);
pParentObjectInfo->Specific.Directory.ChildOpenReferenceCount));
}
+ pIrpSp->FileObject->FsContext = NULL;
+
//
// Decrement the reference count on the Fcb. this is protecting it from teardown.
//
pCcb = (AFSCcb *)pIrpSp->FileObject->FsContext2;
+ pIrpSp->FileObject->FsContext2 = NULL;
+
//
// Object the Parent ObjectInformationCB
//
{
pParentObjectInfo = AFSFindObjectInfo( pObjectInfo->VolumeCB,
- &pObjectInfo->ParentFileId);
+ &pObjectInfo->ParentFileId,
+ FALSE);
}
AFSDbgTrace(( AFS_SUBSYSTEM_LOCK_PROCESSING,
stPipeClose.RootId = pObjectInfo->VolumeCB->ObjectInformation.FileId;
//
- // Issue the open request to the service
- //
-
- /*
- AFSProcessRequest( AFS_REQUEST_TYPE_PIPE_CLOSE,
- AFS_REQUEST_FLAG_SYNCHRONOUS,
- &pFcb->AuthGroup,
- &pDirCB->NameInformation.FileName,
- NULL,
- NULL,
- 0,
- (void *)&stPipeClose,
- sizeof( AFSPipeOpenCloseRequestCB),
- NULL,
- NULL);
- */
-
- //
// Remove the Ccb and de-allocate it
//
AFSReleaseResource( &pFcb->NPFcb->Resource);
+ pIrpSp->FileObject->FsContext = NULL;
+
lCount = InterlockedDecrement( &pFcb->OpenReferenceCount);
AFSDbgTrace(( AFS_SUBSYSTEM_FCB_REF_COUNTING,
}
default:
+ {
AFSDbgTrace(( AFS_SUBSYSTEM_FILE_PROCESSING,
AFS_TRACE_LEVEL_ERROR,
pFcb->Header.NodeTypeCode));
break;
+ }
}
try_exit: