Author: pschweitzer
Date: Sun Jun  4 08:02:01 2017
New Revision: 74897

URL: http://svn.reactos.org/svn/reactos?rev=74897&view=rev
Log:
[UDFS]
lolfix some deadlocks in UDFS:
- deadlock when enumerating files
- deadlock on shutdown after volume change

I could track it to the fact that for whatever reason, GCC wrongly optimize the
BOOLEAN used to store whether the VCB resource was acquired. The optimization 
being
to assume it's always FALSE. Thus, the resource is never released and the driver
ends in a deadlock.
To avoid this: marked the BOOLEAN variables as volatile.

I guess there are same kind deadlocks I couldn't see in my limited tests...

CORE-4375

Modified:
    trunk/reactos/drivers/filesystems/udfs/close.cpp
    trunk/reactos/drivers/filesystems/udfs/create.cpp

Modified: trunk/reactos/drivers/filesystems/udfs/close.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/udfs/close.cpp?rev=74897&r1=74896&r2=74897&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/udfs/close.cpp    [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/udfs/close.cpp    [iso-8859-1] Sun Jun  4 
08:02:01 2017
@@ -1109,7 +1109,7 @@
 {
     PtrUDFIrpContextLite    IrpContextLite;
     BOOLEAN                 StartWorker = FALSE;
-    BOOLEAN                 AcquiredVcb = FALSE;
+    volatile BOOLEAN        AcquiredVcb = FALSE;
     NTSTATUS                RC;
 
     AdPrint(("  UDFQueueDelayedClose\n"));

Modified: trunk/reactos/drivers/filesystems/udfs/create.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/udfs/create.cpp?rev=74897&r1=74896&r2=74897&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/udfs/create.cpp   [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/udfs/create.cpp   [iso-8859-1] Sun Jun  4 
08:02:01 2017
@@ -205,7 +205,7 @@
     PACCESS_STATE               AccessState;
 
     PVCB                        Vcb = NULL;
-    BOOLEAN                     AcquiredVcb = FALSE;
+    volatile BOOLEAN            AcquiredVcb = FALSE;
     BOOLEAN                     OpenExisting = FALSE;
     PERESOURCE                  Res1 = NULL;
     PERESOURCE                  Res2 = NULL;


Reply via email to