[PATCH] blk: Fix SG_IO ioctl failure retry looping
authorJens Axboe <axboe@suse.de>
Fri, 3 Feb 2006 07:37:08 +0000 (08:37 +0100)
committerJens Axboe <axboe@nelson.home.kernel.dk>
Wed, 8 Feb 2006 09:07:13 +0000 (10:07 +0100)
When issuing an SG_IO ioctl through sd that resulted in an unrecoverable
error, a nearly infinite retry loop was discovered. This is due to the
fact that the block layer SG_IO code is not setting up rq->retries. This
patch also fixes up the sg_scsi_ioctl path.

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: Jens Axboe <axboe@suse.de>

block/scsi_ioctl.c

index cc72210..24f7af9 100644 (file)
@@ -310,6 +310,8 @@ static int sg_io(struct file *file, request_queue_t *q,
        if (!rq->timeout)
                rq->timeout = BLK_DEFAULT_TIMEOUT;
 
+       rq->retries = 0;
+
        start_time = jiffies;
 
        /* ignore return value. All information is passed back to caller
@@ -427,6 +429,7 @@ static int sg_scsi_ioctl(struct file *file, request_queue_t *q,
        rq->data = buffer;
        rq->data_len = bytes;
        rq->flags |= REQ_BLOCK_PC;
+       rq->retries = 0;
 
        blk_execute_rq(q, bd_disk, rq, 0);
        err = rq->errors & 0xff;        /* only 8 bit SCSI status */