Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: core: Always send batch on reset or error handling command

In commit 8930a6c20791 ("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: 8930a6c20791 ("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>

authored by

Alexander Atanasov and committed by
Martin K. Petersen
066c5b46 08c94d80

+2
+2
drivers/scsi/scsi_error.c
··· 1152 1152 1153 1153 scsi_log_send(scmd); 1154 1154 scmd->submitter = SUBMITTED_BY_SCSI_ERROR_HANDLER; 1155 + scmd->flags |= SCMD_LAST; 1155 1156 1156 1157 /* 1157 1158 * Lock sdev->state_mutex to avoid that scsi_device_quiesce() can ··· 2460 2459 scsi_init_command(dev, scmd); 2461 2460 2462 2461 scmd->submitter = SUBMITTED_BY_SCSI_RESET_IOCTL; 2462 + scmd->flags |= SCMD_LAST; 2463 2463 memset(&scmd->sdb, 0, sizeof(scmd->sdb)); 2464 2464 2465 2465 scmd->cmd_len = 0;