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

[win-pv-devel] [PATCH 14/14] IoCsqInsertIrpEx already calls IoMarkIrpPending



From: Owen Smith <owen.smith@xxxxxxxxxx>

Also, if an IRP is marked pending, its dispatch call MUST return
STATUS_PENDING, even if it completes the IRP

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xencons/console.c |  3 ++-
 src/xencons/fdo.c     |  4 +---
 src/xencons/pdo.c     |  4 +---
 src/xencons/ring.c    | 14 ++++++++++++--
 4 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/xencons/console.c b/src/xencons/console.c
index e26e1db..4615ebe 100755
--- a/src/xencons/console.c
+++ b/src/xencons/console.c
@@ -221,11 +221,12 @@ ConsoleDispatchReadWrite(
     if (Handle == NULL)
         goto fail1;
 
+    // If StreamPutQueue succeeds, the IRP is queued and marked pending
     status = StreamPutQueue(Handle->Stream, Irp);
     if (!NT_SUCCESS(status))
         goto fail2;
 
-    return STATUS_SUCCESS;
+    return STATUS_PENDING;
 
 fail2:
     Error("fail2\n");
diff --git a/src/xencons/fdo.c b/src/xencons/fdo.c
index 6aad6e2..04dceb5 100644
--- a/src/xencons/fdo.c
+++ b/src/xencons/fdo.c
@@ -2871,11 +2871,9 @@ FdoDispatchReadWrite(
 {
     NTSTATUS            status;
 
-    IoMarkIrpPending(Irp);
-
     status = ConsoleDispatchReadWrite(Fdo->Console,
                                       Irp);
-    if (!NT_SUCCESS(status))
+    if (status != STATUS_PENDING)
         goto fail1;
 
     return STATUS_PENDING;
diff --git a/src/xencons/pdo.c b/src/xencons/pdo.c
index 877b21a..ccd9714 100755
--- a/src/xencons/pdo.c
+++ b/src/xencons/pdo.c
@@ -1673,10 +1673,8 @@ PdoDispatchReadWrite(
 {
     NTSTATUS            status;
 
-    IoMarkIrpPending(Irp);
-
     status = RingDispatchReadWrite(FrontendGetRing(Pdo->Frontend), Irp);
-    if (!NT_SUCCESS(status))
+    if (status != STATUS_PENDING)
         goto fail1;
 
     return STATUS_PENDING;
diff --git a/src/xencons/ring.c b/src/xencons/ring.c
index 83e1761..497aa66 100755
--- a/src/xencons/ring.c
+++ b/src/xencons/ring.c
@@ -560,6 +560,7 @@ RingDispatchReadWrite(
         if (StackLocation->Parameters.Read.Length == 0)
             break;
         status = IoCsqInsertIrpEx(&Ring->Read.Csq, Irp, NULL, (PVOID)FALSE);
+        ASSERT(NT_SUCCESS(status));
         break;
 
     case IRP_MJ_WRITE:
@@ -567,14 +568,23 @@ RingDispatchReadWrite(
         if (StackLocation->Parameters.Write.Length == 0)
             break;
         status = IoCsqInsertIrpEx(&Ring->Write.Csq, Irp, NULL, (PVOID)FALSE);
+        ASSERT(NT_SUCCESS(status));
         break;
 
     default:
         status = STATUS_NOT_SUPPORTED;
         break;
     }
-    if (NT_SUCCESS(status))
-        KeInsertQueueDpc(&Ring->Dpc, NULL, NULL);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
+    KeInsertQueueDpc(&Ring->Dpc, NULL, NULL);
+
+    // IoCsqInsertIrpEx has marked the IRP pending, must return STATUS_PENDING
+    return STATUS_PENDING;
+
+fail1:
+    Error("fail1 (%08x)\n", status);
 
     return status;
 }
-- 
2.8.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel

 


Rackspace

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