Skip to content

Commit

Permalink
[viostor] Fix returning SUCCESS when really -ENOSPC (regression)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
benyamin-codez authored and YanVugenfirer committed Feb 11, 2025
1 parent 2f49453 commit 2bcf04f
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions viostor/virtio_stor_hw_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ RhelDoFlush(PVOID DeviceExtension, PSRB_TYPE Srb, BOOLEAN resend, BOOLEAN bIsr)
element = &adaptExt->processing_srbs[QueueNumber];
InsertTailList(&element->srb_list, &srbExt->vbr.list_entry);
element->srb_cnt++;
result = TRUE;
#ifdef DBG
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
#endif
}
else
{
Expand All @@ -154,10 +158,6 @@ RhelDoFlush(PVOID DeviceExtension, PSRB_TYPE Srb, BOOLEAN resend, BOOLEAN bIsr)
{
VioStorVQUnlock(DeviceExtension, MessageId, &LockHandle, FALSE);
}
#ifdef DBG
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
#endif
result = TRUE;
if (notify)
{
virtqueue_notify(adaptExt->vq[QueueNumber]);
Expand Down Expand Up @@ -231,17 +231,17 @@ RhelDoReadWrite(PVOID DeviceExtension, PSRB_TYPE Srb)
element = &adaptExt->processing_srbs[QueueNumber];
InsertTailList(&element->srb_list, &srbExt->vbr.list_entry);
element->srb_cnt++;
result = TRUE;
#ifdef DBG
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
#endif
}
else
{
RhelDbgPrint(TRACE_LEVEL_ERROR, " Can not add packet to queue %d.\n", QueueNumber);
StorPortBusy(DeviceExtension, 2);
}
VioStorVQUnlock(DeviceExtension, MessageId, &LockHandle, FALSE);
#ifdef DBG
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
#endif
result = TRUE;
if (notify)
{
virtqueue_notify(adaptExt->vq[QueueNumber]);
Expand Down Expand Up @@ -388,17 +388,17 @@ RhelDoUnMap(IN PVOID DeviceExtension, IN PSRB_TYPE Srb)
element = &adaptExt->processing_srbs[QueueNumber];
InsertTailList(&element->srb_list, &srbExt->vbr.list_entry);
element->srb_cnt++;
result = TRUE;
#ifdef DBG
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
#endif
}
else
{
RhelDbgPrint(TRACE_LEVEL_ERROR, " Can not add packet to queue %d.\n", QueueNumber);
StorPortBusy(DeviceExtension, 2);
}
VioStorVQUnlock(DeviceExtension, MessageId, &LockHandle, FALSE);
#ifdef DBG
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
#endif
result = TRUE;
if (notify)
{
RhelDbgPrint(TRACE_LEVEL_INFORMATION, " %s virtqueue_notify %d.\n", __FUNCTION__, QueueNumber);
Expand Down Expand Up @@ -486,17 +486,17 @@ RhelGetSerialNumber(IN PVOID DeviceExtension, IN PSRB_TYPE Srb)
element = &adaptExt->processing_srbs[QueueNumber];
InsertTailList(&element->srb_list, &srbExt->vbr.list_entry);
element->srb_cnt++;
result = TRUE;
#ifdef DBG
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
#endif
}
else
{
RhelDbgPrint(TRACE_LEVEL_ERROR, " Can not add packet to queue %d.\n", QueueNumber);
StorPortBusy(DeviceExtension, 2);
}
VioStorVQUnlock(DeviceExtension, MessageId, &LockHandle, FALSE);
#ifdef DBG
InterlockedIncrement((LONG volatile *)&adaptExt->inqueue_cnt);
#endif
result = TRUE;
if (notify)
{
virtqueue_notify(adaptExt->vq[QueueNumber]);
Expand Down

0 comments on commit 2bcf04f

Please sign in to comment.