[RFC PATCH] scsi_transport_fc: Make sure commands are completed when rport is offline

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux