|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v3 11/11] ring: Defer faking submitted requests until disconnect
Currently, XenVbd fakes responses before the ring close is truly
acknowledged by the backend. Since the backend is not made aware that we
are going to complete the faked requests on our own, it may end up
servicing these requests after we have already faked the responses.
We should do things the other way around instead, i.e. close the ring
first, then fake responses later.
Assisted-by: LLM
Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
New in v3.
---
src/xenvbd/ring.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
index d71bbe1..4a63ac8 100644
--- a/src/xenvbd/ring.c
+++ b/src/xenvbd/ring.c
@@ -2656,19 +2656,8 @@ BlkifRingDisable(
__BlkifRingAcquireLock(BlkifRing);
BlkifRing->Enabled = FALSE;
- while (!IsListEmpty(&BlkifRing->SubmittedList)) {
- PLIST_ENTRY ListEntry;
- PXENVBD_REQUEST Request;
-
- ListEntry = RemoveHeadList(&BlkifRing->SubmittedList);
- ASSERT3P(ListEntry, !=, &BlkifRing->SubmittedList);
-
- Request = CONTAINING_RECORD(ListEntry, XENVBD_REQUEST, ListEntry);
- BlkifRing->ResponsesProcessed++;
- __BlkifRingCompleteResponse(BlkifRing, Request, BLKIF_RSP_ERROR);
-
+ if (!IsListEmpty(&BlkifRing->SubmittedList))
BlkifRing->Poisoned = TRUE;
- }
while (!IsListEmpty(&BlkifRing->PreparedQueue)) {
PLIST_ENTRY ListEntry;
@@ -2712,9 +2701,22 @@ BlkifRingDisconnect(
BlkifRing->Channel);
BlkifRing->Channel = NULL;
+ __BlkifRingAcquireLock(BlkifRing);
+
+ while (!IsListEmpty(&BlkifRing->SubmittedList)) {
+ PLIST_ENTRY ListEntry;
+ PXENVBD_REQUEST Request;
+
+ ListEntry = RemoveHeadList(&BlkifRing->SubmittedList);
+ ASSERT3P(ListEntry, !=, &BlkifRing->SubmittedList);
+
+ Request = CONTAINING_RECORD(ListEntry, XENVBD_REQUEST, ListEntry);
+ BlkifRing->ResponsesProcessed++;
+ __BlkifRingCompleteResponse(BlkifRing, Request, BLKIF_RSP_ERROR);
+ }
+
// Normally the backend has closed by now, so anything still deferred
// should be revocable
- __BlkifRingAcquireLock(BlkifRing);
BlkifRingReclaim(BlkifRing);
Deferring = !IsListEmpty(&BlkifRing->DeferredList);
__BlkifRingReleaseLock(BlkifRing);
--
2.56.0.windows.4
--
Ngoc Tu Dinh | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |