Skip to content

Commit 066c5b4

Browse files
vzatanasovmartinkpetersen
authored andcommitted
scsi: core: Always send batch on reset or error handling command
In commit 8930a6c ("scsi: core: add support for request batching") the block layer bd->last flag was mapped to SCMD_LAST and used as an indicator to send the batch for the drivers that implement this feature. However, the error handling code was not updated accordingly. scsi_send_eh_cmnd() is used to send error handling commands and request sense. The problem is that request sense comes as a single command that gets into the batch queue and times out. As a result the device goes offline after several failed resets. This was observed on virtio_scsi during a device resize operation. [ 496.316946] sd 0:0:4:0: [sdd] tag#117 scsi_eh_0: requesting sense [ 506.786356] sd 0:0:4:0: [sdd] tag#117 scsi_send_eh_cmnd timeleft: 0 [ 506.787981] sd 0:0:4:0: [sdd] tag#117 abort To fix this always set SCMD_LAST flag in scsi_send_eh_cmnd() and scsi_reset_ioctl(). Fixes: 8930a6c ("scsi: core: add support for request batching") Cc: <stable@vger.kernel.org> Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com> Link: https://lore.kernel.org/r/20231215121008.2881653-1-alexander.atanasov@virtuozzo.com Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 08c94d8 commit 066c5b4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/scsi/scsi_error.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,7 @@ static enum scsi_disposition scsi_send_eh_cmnd(struct scsi_cmnd *scmd,
11521152

11531153
scsi_log_send(scmd);
11541154
scmd->submitter = SUBMITTED_BY_SCSI_ERROR_HANDLER;
1155+
scmd->flags |= SCMD_LAST;
11551156

11561157
/*
11571158
* Lock sdev->state_mutex to avoid that scsi_device_quiesce() can
@@ -2459,6 +2460,7 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)
24592460
scsi_init_command(dev, scmd);
24602461

24612462
scmd->submitter = SUBMITTED_BY_SCSI_RESET_IOCTL;
2463+
scmd->flags |= SCMD_LAST;
24622464
memset(&scmd->sdb, 0, sizeof(scmd->sdb));
24632465

24642466
scmd->cmd_len = 0;

0 commit comments

Comments
 (0)