[SCSI] sg: fix q->queue_lock on scsi_error_handler path
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Fri, 3 Apr 2009 10:28:06 +0000 (19:28 +0900)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Fri, 3 Apr 2009 15:23:16 +0000 (10:23 -0500)
commit015640edb1f346e0b2eda703587c4cd1c310ec1d
treefd7016b45278d26eac055f1f613632b40832f46e
parent1beb6fa85ca9afaee109811a3f4a984232a32a4f
[SCSI] sg: fix q->queue_lock on scsi_error_handler path

sg_rq_end_io() is called via rq->end_io. In some rare cases,
sg_rq_end_io calls blk_put_request/blk_rq_unmap_user (when a program
issuing a command has gone before the command completion; e.g. by
interrupting a program issuing a command before the command
completes).

We can't call blk_put_request/blk_rq_unmap_user in interrupt so the
commit c96952ed7031e7c576ecf90cf95b8ec099d5295a uses
execute_in_process_context().

The problem is that scsi_error_handler() calls rq->end_io too. We
can't call blk_put_request/blk_rq_unmap_user too in this path (we hold
q->queue_lock).

To avoid the above problem, in these rare cases, this patch always
uses schedule_work() instead of execute_in_process_context().

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/sg.c