aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-12-05 17:49:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-12-05 17:49:18 -0500
commitf2f1fa78a155524b849edf359e42a3001ea652c0 (patch)
tree8d38fc76e48fc219e393ee57ee5f76843b735258
parent24920a79a27dd28e67088bbfcf36746d15587f4d (diff)
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>
-rw-r--r--block/bsg.c2
-rw-r--r--block/scsi_ioctl.c2
-rw-r--r--include/linux/blkdev.h1
3 files changed, 5 insertions, 0 deletions
diff --git a/block/bsg.c b/block/bsg.c
index e8bd2475682a..e73e50daf3d0 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -202,6 +202,8 @@ static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq,
202 rq->timeout = q->sg_timeout; 202 rq->timeout = q->sg_timeout;
203 if (!rq->timeout) 203 if (!rq->timeout)
204 rq->timeout = BLK_DEFAULT_SG_TIMEOUT; 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 return 0; 208 return 0;
207} 209}
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 5963cf91a3a0..d0bb92cbefb9 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -208,6 +208,8 @@ static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
208 rq->timeout = q->sg_timeout; 208 rq->timeout = q->sg_timeout;
209 if (!rq->timeout) 209 if (!rq->timeout)
210 rq->timeout = BLK_DEFAULT_SG_TIMEOUT; 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 return 0; 214 return 0;
213} 215}
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 6dcd30d806cd..031a315c0509 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -662,6 +662,7 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn;
662 * default timeout for SG_IO if none specified 662 * default timeout for SG_IO if none specified
663 */ 663 */
664#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ) 664#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
665#define BLK_MIN_SG_TIMEOUT (7 * HZ)
665 666
666#ifdef CONFIG_BOUNCE 667#ifdef CONFIG_BOUNCE
667extern int init_emergency_isa_pool(void); 668extern int init_emergency_isa_pool(void);