Skip to content

Commit 2bcf04f

Browse files
benyamin-codezYanVugenfirer
authored andcommitted
[viostor] Fix returning SUCCESS when really -ENOSPC (regression)
1. Refactored to only return TRUE when add_buffer_req_status == VQ_ADD_BUFFER_SUCCESS. 2. Pro-actively refactors calls to InterlockedIncrement() back to the add_buffer_req_status == VQ_ADD_BUFFER_SUCCESS path. Impacts: RhelDoFlush(), RhelDoReadWrite(), RhelDoUnMap() and RhelGetSerialNumber(). Regression introduced with PR #1174 (379f291). Will likely resolve issue #1204 (RHEL-70446), unlikely to resolve issue #907. My bad... 8^d Signed-off-by: benyamin-codez <115509179+benyamin-codez@users.noreply.github.com>
1 parent 2f49453 commit 2bcf04f

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

viostor/virtio_stor_hw_helper.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ RhelDoFlush(PVOID DeviceExtension, PSRB_TYPE Srb, BOOLEAN resend, BOOLEAN bIsr)
144144
element = &adaptExt->processing_srbs[QueueNumber];
145145
InsertTailList(&element->srb_list, &srbExt->vbr.list_entry);
146146
element->srb_cnt++;
147+
result = TRUE;
148+
#ifdef DBG
149+
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
150+
#endif
147151
}
148152
else
149153
{
@@ -154,10 +158,6 @@ RhelDoFlush(PVOID DeviceExtension, PSRB_TYPE Srb, BOOLEAN resend, BOOLEAN bIsr)
154158
{
155159
VioStorVQUnlock(DeviceExtension, MessageId, &LockHandle, FALSE);
156160
}
157-
#ifdef DBG
158-
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
159-
#endif
160-
result = TRUE;
161161
if (notify)
162162
{
163163
virtqueue_notify(adaptExt->vq[QueueNumber]);
@@ -231,17 +231,17 @@ RhelDoReadWrite(PVOID DeviceExtension, PSRB_TYPE Srb)
231231
element = &adaptExt->processing_srbs[QueueNumber];
232232
InsertTailList(&element->srb_list, &srbExt->vbr.list_entry);
233233
element->srb_cnt++;
234+
result = TRUE;
235+
#ifdef DBG
236+
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
237+
#endif
234238
}
235239
else
236240
{
237241
RhelDbgPrint(TRACE_LEVEL_ERROR, " Can not add packet to queue %d.\n", QueueNumber);
238242
StorPortBusy(DeviceExtension, 2);
239243
}
240244
VioStorVQUnlock(DeviceExtension, MessageId, &LockHandle, FALSE);
241-
#ifdef DBG
242-
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
243-
#endif
244-
result = TRUE;
245245
if (notify)
246246
{
247247
virtqueue_notify(adaptExt->vq[QueueNumber]);
@@ -388,17 +388,17 @@ RhelDoUnMap(IN PVOID DeviceExtension, IN PSRB_TYPE Srb)
388388
element = &adaptExt->processing_srbs[QueueNumber];
389389
InsertTailList(&element->srb_list, &srbExt->vbr.list_entry);
390390
element->srb_cnt++;
391+
result = TRUE;
392+
#ifdef DBG
393+
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
394+
#endif
391395
}
392396
else
393397
{
394398
RhelDbgPrint(TRACE_LEVEL_ERROR, " Can not add packet to queue %d.\n", QueueNumber);
395399
StorPortBusy(DeviceExtension, 2);
396400
}
397401
VioStorVQUnlock(DeviceExtension, MessageId, &LockHandle, FALSE);
398-
#ifdef DBG
399-
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
400-
#endif
401-
result = TRUE;
402402
if (notify)
403403
{
404404
RhelDbgPrint(TRACE_LEVEL_INFORMATION, " %s virtqueue_notify %d.\n", __FUNCTION__, QueueNumber);
@@ -486,17 +486,17 @@ RhelGetSerialNumber(IN PVOID DeviceExtension, IN PSRB_TYPE Srb)
486486
element = &adaptExt->processing_srbs[QueueNumber];
487487
InsertTailList(&element->srb_list, &srbExt->vbr.list_entry);
488488
element->srb_cnt++;
489+
result = TRUE;
490+
#ifdef DBG
491+
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
492+
#endif
489493
}
490494
else
491495
{
492496
RhelDbgPrint(TRACE_LEVEL_ERROR, " Can not add packet to queue %d.\n", QueueNumber);
493497
StorPortBusy(DeviceExtension, 2);
494498
}
495499
VioStorVQUnlock(DeviceExtension, MessageId, &LockHandle, FALSE);
496-
#ifdef DBG
497-
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
498-
#endif
499-
result = TRUE;
500500
if (notify)
501501
{
502502
virtqueue_notify(adaptExt->vq[QueueNumber]);

0 commit comments

Comments
 (0)