Commit 01840f9c9d7ae366311302077ace6bc39169399b

Authored by Jens Axboe
Committed by Jens Axboe
1 parent ac171c4666

[PATCH] blk: Fix SG_IO ioctl failure retry looping

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>

Showing 1 changed file with 3 additions and 0 deletions Side-by-side Diff

... ... @@ -310,6 +310,8 @@
310 310 if (!rq->timeout)
311 311 rq->timeout = BLK_DEFAULT_TIMEOUT;
312 312  
  313 + rq->retries = 0;
  314 +
313 315 start_time = jiffies;
314 316  
315 317 /* ignore return value. All information is passed back to caller
... ... @@ -427,6 +429,7 @@
427 429 rq->data = buffer;
428 430 rq->data_len = bytes;
429 431 rq->flags |= REQ_BLOCK_PC;
  432 + rq->retries = 0;
430 433  
431 434 blk_execute_rq(q, bd_disk, rq, 0);
432 435 err = rq->errors & 0xff; /* only 8 bit SCSI status */