[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Stop all RingWatchdog threads



Fix an issue where all RingWatchdog threads were not getting stopped when a
REMOVE_DEVICE is processed. This issue does not hit in normal operation where
XenVbd will go through the system power transitions instead of receiving
IRP_MN_REMOVE_DEVICE. In normal operations, the boot disk will prevent you
from disabling the XenVbd device, and XenVbd will not get IRP_MN_REMOVE_DEVICE.

If XenVbd is enumerating only non-emulateable disks, then it can be removed,
which did not stop all RingWatchdog threads. Once these threads attempt to
access any data from the now unloaded driver, a 0xCE
DRIVER_UNLOADED_WITHOUT_CANCELLING_PENDING_OPERATIONS bugcheck will be observed.

Correct an out-by-one issue with the cleanup code, so all RingWatchdog threads
are correctly stopped before unloading in this case.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xenvbd/ring.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
index d05dfc3..6520dff 100644
--- a/src/xenvbd/ring.c
+++ b/src/xenvbd/ring.c
@@ -2503,12 +2503,13 @@ RingDestroy(
     IN  PXENVBD_RING    Ring
     )
 {
+    ULONG               MaxQueues;
     ULONG               Index;
 
-    Index = FrontendGetMaxQueues(Ring->Frontend);
-    ASSERT3U(Index, !=, 0);
+    MaxQueues = FrontendGetMaxQueues(Ring->Frontend);
+    ASSERT3U(MaxQueues, !=, 0);
 
-    while (--Index != 0) {
+    for (Index = 0; Index < MaxQueues; ++Index) {
         PXENVBD_BLKIF_RING  BlkifRing = Ring->Ring[Index];
 
         Ring->Ring[Index] = NULL;
-- 
2.51.2.windows.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.