Author: fireball
Date: Sun Sep 27 22:24:22 2009
New Revision: 43194
URL:
http://svn.reactos.org/svn/reactos?rev=43194&view=rev
Log:
[fastfat_new]
- Acquire global lock before touching FatGlobalData structure.
- Initialize global VCB list, fixes a crash at volume mounting.
- Loading goes up to volume mounting, an attempt to query information and open a file.
Modified:
trunk/reactos/drivers/filesystems/fastfat_new/fastfat.c
trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h
trunk/reactos/drivers/filesystems/fastfat_new/fat.c
trunk/reactos/drivers/filesystems/fastfat_new/fsctl.c
Modified: trunk/reactos/drivers/filesystems/fastfat_new/fastfat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/fastfat.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/fastfat.c [iso-8859-1] Sun Sep 27
22:24:22 2009
@@ -108,6 +108,9 @@
/* Initialize synchronization resource for the global data */
ExInitializeResourceLite(&FatGlobalData.Resource);
+ /* Initialize global VCB list */
+ InitializeListHead(&FatGlobalData.VcbListHead);
+
/* Register and reference our filesystem */
IoRegisterFileSystem(DeviceObject);
ObReferenceObject(DeviceObject);
Modified: trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h [iso-8859-1] Sun Sep 27
22:24:22 2009
@@ -13,6 +13,27 @@
#define TAG_FCB 'BCFV'
#define TAG_IRP 'PRIV'
#define TAG_VFAT 'TAFV'
+
+
+/* Global resource acquire/release */
+#define FatAcquireExclusiveGlobal(IrpContext) \
+( \
+ ExAcquireResourceExclusiveLite(&FatGlobalData.Resource, \
+ (IrpContext)->Flags & IRPCONTEXT_CANWAIT) \
+)
+
+#define FatAcquireSharedGlobal(IrpContext) \
+( \
+ ExAcquireResourceSharedLite(&FatGlobalData.Resource, \
+ (IrpContext)->Flags & IRPCONTEXT_CANWAIT) \
+)
+
+#define FatReleaseGlobal(IrpContext) \
+{ \
+ ExReleaseResourceLite(&(FatGlobalData.Resource)); \
+}
+
+
/* ------------------------------------------------------ shutdown.c */
DRIVER_DISPATCH FatShutdown;
@@ -145,6 +166,7 @@
NTSTATUS
FatInitializeVcb(
+ IN PFAT_IRP_CONTEXT IrpContext,
IN PVCB Vcb,
IN PDEVICE_OBJECT TargetDeviceObject,
IN PVPB Vpb);
Modified: trunk/reactos/drivers/filesystems/fastfat_new/fat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/fat.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/fat.c [iso-8859-1] Sun Sep 27 22:24:22
2009
@@ -445,7 +445,8 @@
}
NTSTATUS
-FatInitializeVcb(IN PVCB Vcb,
+FatInitializeVcb(IN PFAT_IRP_CONTEXT IrpContext,
+ IN PVCB Vcb,
IN PDEVICE_OBJECT TargetDeviceObject,
IN PVPB Vpb)
{
@@ -533,8 +534,11 @@
/* Call helper function */
FatiInitializeVcb(Vcb);
- /* Add this Vcb to grobal Vcb list. */
+ /* Add this Vcb to global Vcb list */
+ (VOID)FatAcquireExclusiveGlobal(IrpContext);
InsertTailList(&FatGlobalData.VcbListHead, &Vcb->VcbLinks);
+ FatReleaseGlobal(IrpContext);
+
return STATUS_SUCCESS;
FatInitializeVcbCleanup:
Modified: trunk/reactos/drivers/filesystems/fastfat_new/fsctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/fsctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/fsctl.c [iso-8859-1] Sun Sep 27 22:24:22
2009
@@ -121,7 +121,7 @@
Vpb->DeviceObject = (PDEVICE_OBJECT)VolumeDevice;
/* Initialize VCB for this volume */
- Status = FatInitializeVcb(&VolumeDevice->Vcb, TargetDeviceObject, Vpb);
+ Status = FatInitializeVcb(IrpContext, &VolumeDevice->Vcb, TargetDeviceObject,
Vpb);
if (!NT_SUCCESS(Status)) goto FatMountVolumeCleanup;
/* Keep trace of media changes */