Commit 268940b8 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen
Browse files

scsi: scsi_dh_alua: Return BLK_STS_AGAIN for ALUA transitioning state

When the ALUA state indicates transitioning we should not retry the command
immediately, but rather complete the command with BLK_STS_AGAIN to signal
the completion handler that it might be retried.  This allows multipathing
to redirect the command to another path if possible, and avoid stalls
during lengthy transitioning times.

Link: https://lore.kernel.org/r/20200930080256.90964-3-hare@suse.de


Reviewed-by: default avatarEwan D. Milne <emilne@redhat.com>
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent e21ee5a6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1091,7 +1091,7 @@ static blk_status_t alua_prep_fn(struct scsi_device *sdev, struct request *req)
	case SCSI_ACCESS_STATE_LBA:
		return BLK_STS_OK;
	case SCSI_ACCESS_STATE_TRANSITIONING:
		return BLK_STS_RESOURCE;
		return BLK_STS_AGAIN;
	default:
		req->rq_flags |= RQF_QUIET;
		return BLK_STS_IOERR;
+5 −0
Original line number Diff line number Diff line
@@ -1707,6 +1707,11 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
		    scsi_device_blocked(sdev))
			ret = BLK_STS_DEV_RESOURCE;
		break;
	case BLK_STS_AGAIN:
		scsi_req(req)->result = DID_BUS_BUSY << 16;
		if (req->rq_flags & RQF_DONTPREP)
			scsi_mq_uninit_cmd(cmd);
		break;
	default:
		if (unlikely(!scsi_device_online(sdev)))
			scsi_req(req)->result = DID_NO_CONNECT << 16;