Hello, Jens. On Wed, Apr 20, 2005 at 08:30:10AM +0200, Jens Axboe wrote: > Do it on requeue, please - not on the initial spotting of the request. 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(). Other patches apply cleanly with this patch or the original one and the end result is the same, so take your pick. :-) Signed-off-by: Tejun Heo <htejun@xxxxxxxxx> Index: scsi-reqfn-export/drivers/block/elevator.c =================================================================== --- scsi-reqfn-export.orig/drivers/block/elevator.c 2005-04-20 16:24:26.000000000 +0900 +++ scsi-reqfn-export/drivers/block/elevator.c 2005-04-20 16:31:36.000000000 +0900 @@ -291,6 +291,13 @@ void elv_requeue_request(request_queue_t } /* + * the request is prepped and may have some resources allocated. + * allowing unprepped requests to pass this one may cause resource + * deadlock. turn on softbarrier. + */ + rq->flags |= REQ_SOFTBARRIER; + + /* * if iosched has an explicit requeue hook, then use that. otherwise * just put the request at the front of the queue */ @@ -386,6 +393,12 @@ struct request *elv_next_request(request if (ret == BLKPREP_OK) { break; } else if (ret == BLKPREP_DEFER) { + /* + * the request may have been (partially) prepped. + * we need to keep this request in the front to + * avoid resource deadlock. turn on softbarrier. + */ + rq->flags |= REQ_SOFTBARRIER; rq = NULL; break; } else if (ret == BLKPREP_KILL) { - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html