Enforce a minimum SG_IO timeout

There's no point in having too short SG_IO timeouts, since if the
command does end up timing out, we'll end up through the reset sequence
that is several seconds long in order to abort the command that timed
out.

As a result, shorter timeouts than a few seconds simply do not make
sense, as the recovery would be longer than the timeout itself.

Add a BLK_MIN_SG_TIMEOUT to match the existign BLK_DEFAULT_SG_TIMEOUT.

Suggested-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+5
+2
block/bsg.c
··· 202 202 rq->timeout = q->sg_timeout; 203 203 if (!rq->timeout) 204 204 rq->timeout = BLK_DEFAULT_SG_TIMEOUT; 205 + if (rq->timeout < BLK_MIN_SG_TIMEOUT) 206 + rq->timeout = BLK_MIN_SG_TIMEOUT; 205 207 206 208 return 0; 207 209 }
+2
block/scsi_ioctl.c
··· 208 208 rq->timeout = q->sg_timeout; 209 209 if (!rq->timeout) 210 210 rq->timeout = BLK_DEFAULT_SG_TIMEOUT; 211 + if (rq->timeout < BLK_MIN_SG_TIMEOUT) 212 + rq->timeout = BLK_MIN_SG_TIMEOUT; 211 213 212 214 return 0; 213 215 }
+1
include/linux/blkdev.h
··· 662 662 * default timeout for SG_IO if none specified 663 663 */ 664 664 #define BLK_DEFAULT_SG_TIMEOUT (60 * HZ) 665 + #define BLK_MIN_SG_TIMEOUT (7 * HZ) 665 666 666 667 #ifdef CONFIG_BOUNCE 667 668 extern int init_emergency_isa_pool(void);