Author: pschweitzer
Date: Sat Oct 10 12:33:22 2015
New Revision: 69482
URL:
http://svn.reactos.org/svn/reactos?rev=69482&view=rev
Log:
[MSFS]
- Remove an useless (and unsafe!) counter
- Use the message counter in a thread-safe way in RW operations
Modified:
trunk/reactos/drivers/filesystems/msfs/create.c
trunk/reactos/drivers/filesystems/msfs/msfs.h
trunk/reactos/drivers/filesystems/msfs/rw.c
Modified: trunk/reactos/drivers/filesystems/msfs/create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/msfs/c…
==============================================================================
--- trunk/reactos/drivers/filesystems/msfs/create.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/msfs/create.c [iso-8859-1] Sat Oct 10 12:33:22 2015
@@ -181,7 +181,6 @@
InitializeListHead(&Fcb->MessageListHead);
KeInitializeSpinLock(&Fcb->MessageListLock);
- Fcb->WaitCount = 0;
KeInitializeSpinLock(&Fcb->QueueLock);
InitializeListHead(&Fcb->PendingIrpQueue);
IoCsqInitialize(&Fcb->CancelSafeQueue,
Modified: trunk/reactos/drivers/filesystems/msfs/msfs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/msfs/m…
==============================================================================
--- trunk/reactos/drivers/filesystems/msfs/msfs.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/msfs/msfs.h [iso-8859-1] Sat Oct 10 12:33:22 2015
@@ -38,7 +38,6 @@
IO_CSQ CancelSafeQueue;
KSPIN_LOCK QueueLock;
LIST_ENTRY PendingIrpQueue;
- ULONG WaitCount;
} MSFS_FCB, *PMSFS_FCB;
Modified: trunk/reactos/drivers/filesystems/msfs/rw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/msfs/r…
==============================================================================
--- trunk/reactos/drivers/filesystems/msfs/rw.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/msfs/rw.c [iso-8859-1] Sat Oct 10 12:33:22 2015
@@ -62,10 +62,11 @@
Buffer = Irp->UserBuffer;
+ KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
if (Fcb->MessageCount > 0)
{
- KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
Entry = RemoveHeadList(&Fcb->MessageListHead);
+ Fcb->MessageCount--;
KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
/* copy current message into buffer */
@@ -74,13 +75,16 @@
LengthRead = Message->Size;
ExFreePoolWithTag(Message, 'rFsM');
- Fcb->MessageCount--;
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = LengthRead;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
+ }
+ else
+ {
+ KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
}
Timeout = Fcb->TimeOut;
@@ -116,7 +120,6 @@
KeSetTimer(Timer, Timeout, Dpc);
}
- Fcb->WaitCount++;
IoMarkIrpPending(Irp);
return STATUS_PENDING;
@@ -184,16 +187,14 @@
KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
InsertTailList(&Fcb->MessageListHead, &Message->MessageListEntry);
+ Fcb->MessageCount++;
KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
- Fcb->MessageCount++;
-
- if (Fcb->WaitCount > 0)
- {
- CsqIrp = IoCsqRemoveNextIrp(&Fcb->CancelSafeQueue, NULL);
+ CsqIrp = IoCsqRemoveNextIrp(&Fcb->CancelSafeQueue, NULL);
+ if (CsqIrp != NULL)
+ {
/* FIXME: It is necessary to reset the timers. */
MsfsRead(DeviceObject, CsqIrp);
- Fcb->WaitCount--;
}
Irp->IoStatus.Status = STATUS_SUCCESS;