public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] scsi_transport_fc: Make sure commands are completed when rport is offline
@ 2010-03-09 11:27 Sarang Radke
  2010-03-09 14:41 ` James Smart
  2010-03-10  5:46 ` FUJITA Tomonori
  0 siblings, 2 replies; 6+ messages in thread
From: Sarang Radke @ 2010-03-09 11:27 UTC (permalink / raw)
  To: fujita.tomonori@lab.ntt.co.jp, James.Bottomley@suse.de,
	linux-scsi@vger.kernel.org
  Cc: Andrew Vasquez, Lalit Chandivade, Giridhar Malavali, Ravi Anand

A panic is seen when an ELS BSG request is send for rport which is online, but goes offline before the request is processed.

Here are the details of the issue and the fix.

. The request handler routine fc_bsg_handler checks if the rport is not online and tries to end the request by calling blk_end_request.
. blk_end_request does not finish the request because it calls bidi_end_bidi_request with bidi_bytes = 0.
. After 60 sec. the timeout handler, fc_bsg_job_timeout is invoked for this unfinished command.
. A panic is seen in fc_bsg_job_timeout because req->special is NULL.
. req->special  would have been set by function fc_req_to_bsgjob, if the rport was online.
. The patch uses blk_end_request_all instead of blk_end_request which finishes the bidi request and timeout never happens.


-Thanks,
Sarang

Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
---
 drivers/scsi/scsi_transport_fc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 79660ee..304e710 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -3852,7 +3852,7 @@ fc_bsg_request_handler(struct request_queue *q, struct Scsi_Host *shost,
                if (rport && (rport->port_state != FC_PORTSTATE_ONLINE)) {
                        req->errors = -ENXIO;
                        spin_unlock_irq(q->queue_lock);
-                       blk_end_request(req, -ENXIO, blk_rq_bytes(req));
+                       blk_end_request_all(req, -ENXIO);
                        spin_lock_irq(q->queue_lock);
                        continue;
                }
--
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-03-11  0:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-09 11:27 [RFC PATCH] scsi_transport_fc: Make sure commands are completed when rport is offline Sarang Radke
2010-03-09 14:41 ` James Smart
2010-03-10 10:03   ` Sarang Radke
2010-03-10 14:50     ` James Smart
2010-03-11  0:52     ` FUJITA Tomonori
2010-03-10  5:46 ` FUJITA Tomonori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox