Commit 2e759cd4fa60c6df4cb117848274f444c2c0a12d

Authored by Tejun Heo
Committed by James Bottomley
1 parent 354d6b2196

[SCSI] make blk layer set REQ_SOFTBARRIER on defer and requeue

This is the reworked version of the patch.  It sets REQ_SOFTBARRIER
in two places - in elv_next_request() on BLKPREP_DEFER and in
blk_requeue_request().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

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

drivers/block/elevator.c
... ... @@ -291,6 +291,13 @@
291 291 }
292 292  
293 293 /*
  294 + * the request is prepped and may have some resources allocated.
  295 + * allowing unprepped requests to pass this one may cause resource
  296 + * deadlock. turn on softbarrier.
  297 + */
  298 + rq->flags |= REQ_SOFTBARRIER;
  299 +
  300 + /*
294 301 * if iosched has an explicit requeue hook, then use that. otherwise
295 302 * just put the request at the front of the queue
296 303 */
... ... @@ -386,6 +393,12 @@
386 393 if (ret == BLKPREP_OK) {
387 394 break;
388 395 } else if (ret == BLKPREP_DEFER) {
  396 + /*
  397 + * the request may have been (partially) prepped.
  398 + * we need to keep this request in the front to
  399 + * avoid resource deadlock. turn on softbarrier.
  400 + */
  401 + rq->flags |= REQ_SOFTBARRIER;
389 402 rq = NULL;
390 403 break;
391 404 } else if (ret == BLKPREP_KILL) {