Skip to content

Commit

Permalink
[vioscsi] Fix SendSRB notify regression
Browse files Browse the repository at this point in the history
Fixes regression in SendSRB of [vioscsi]

Regression was introduced in #684 between 7dc052d and fdf56dd.
Specifically due to commits f1338bb and fdf56dd (considered together).

Signed-off-by: benyamin-codez <[email protected]>
  • Loading branch information
benyamin-codez authored and vrozenfe committed Oct 3, 2024
1 parent 351cbc6 commit 0755ca6
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions vioscsi/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ SendSRB(
PVOID va = NULL;
ULONGLONG pa = 0;
ULONG QueueNumber = VIRTIO_SCSI_REQUEST_QUEUE_0;
BOOLEAN notify = FALSE;
STOR_LOCK_HANDLE LockHandle = { 0 };
ULONG status = STOR_STATUS_SUCCESS;
UCHAR ScsiStatus = SCSISTAT_GOOD;
Expand Down Expand Up @@ -110,24 +111,22 @@ ENTER_FN_SRB();
&srbExt->cmd, va, pa);

if (res >= 0) {
notify = virtqueue_kick_prepare(adaptExt->vq[QueueNumber]);
element = &adaptExt->processing_srbs[index];
InsertTailList(&element->srb_list, &srbExt->list_entry);
element->srb_cnt++;
}
VioScsiVQUnlock(DeviceExtension, MessageID, &LockHandle, FALSE);
if ( res >= 0){
if (virtqueue_kick_prepare(adaptExt->vq[QueueNumber])) {
virtqueue_notify(adaptExt->vq[QueueNumber]);
}
} else {
virtqueue_notify(adaptExt->vq[QueueNumber]);
ScsiStatus = SCSISTAT_QUEUE_FULL;
SRB_SET_SRB_STATUS(Srb, SRB_STATUS_BUSY);
SRB_SET_SCSI_STATUS(Srb, ScsiStatus);
StorPortBusy(DeviceExtension, 10);
CompleteRequest(DeviceExtension, Srb);
RhelDbgPrint(TRACE_LEVEL_FATAL, " Could not put an SRB into a VQ, so complete it with SRB_STATUS_BUSY. QueueNumber = %d, SRB = 0x%p, Lun = %d, TimeOut = %d.\n", QueueNumber, srbExt->Srb, SRB_LUN(Srb), Srb->TimeOutValue);
}
VioScsiVQUnlock(DeviceExtension, MessageID, &LockHandle, FALSE);
if (notify){
virtqueue_notify(adaptExt->vq[QueueNumber]);
}

EXIT_FN_SRB();
}
Expand Down

0 comments on commit 0755ca6

Please sign in to comment.