scsi: sd: Allow user to configure command retries
authorMike Christie <michael.christie@oracle.com>
Thu, 1 Oct 2020 15:35:54 +0000 (10:35 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 2 Oct 2020 22:53:07 +0000 (18:53 -0400)
commit0610959fbbca62b534f1f276873fd297f76b164b
tree195e7cf801866c81050c648a9ae22d18c0177fb9
parent2a242d59d6b908341c0d426bc6e7f8e28871cbd0
scsi: sd: Allow user to configure command retries

Some iSCSI targets went with the traditional "export N ports" approach and
then allowed the initiator to multipath over them. Other targets went the
opposite direction and export a single port, and then software on the
target side performs load balancing and failover to other targets via an
iSCSI specific feature or IP takover.

The problem for the 2nd type of config is we quickly run out of our five
retries and get I/O errors. In these setups we want to reduce resource use
on the initiator side so we only wanted the one session and no
dm-multipath.  To handle traditional multipath operations like failover we
do IP takover on the target side. So we would have an iSCSI target running
on node1. Some monitoring software decides it's dead or the node is
overloaded so it starts the iSCSI target on node2. The problem is for the
failover case where we might have the equivalent of a dm-multipath
temporary all paths down, or we just have to try more than 5 nodes before
finding a good one.

To handle this type of issue allow the user to configure the disk cmd
retries from -1 to the current max of 5. -1 means infinite retries and
should be used for setups where some other setting is going to control when
to fail. For example iSCSI has the replacement/recovery timeout and fc
(some users have used FC with NPIV and done something similar as IP
takover) has dev_loss_tmo/fast_io_fail which will eventually expire and
fail I/O.

Link: https://lore.kernel.org/r/1601566554-26752-3-git-send-email-michael.christie@oracle.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c
drivers/scsi/sd.h