* [PATCH v4 0/4] IB/srp fixes
@ 2013-02-21 17:15 Bart Van Assche
[not found] ` <51265641.4060609-HInyCGIudOg@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Bart Van Assche @ 2013-02-21 17:15 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, David Dillow,
Or Gerlitz, Vu Pham, Sagi Grimberg
This patch series avoids that SCSI error handling triggers an endless
loop and also restores reporting of QP errors in the kernel log.
Changes between v4 and v3:
- Added a patch that ensures that the SCSI host gets removed in time
when a user space process keeps queueing I/O during removal, e.g.
an older version of multipathd.
- Added "Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> # 3.8" tag.
Changes between v3 and v2:
- As proposed by Dave, added a patch that prevents sending of a task
management function over a closed connection.
Changes between v2 and v1:
- Track connection state properly.
- Make srp_reset_host() reset requests even if reconnecting fails
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v4 1/4] IB/srp: Track connection state properly
[not found] ` <51265641.4060609-HInyCGIudOg@public.gmane.org>
@ 2013-02-21 17:16 ` Bart Van Assche
2013-02-21 17:18 ` [PATCH v4 2/4] IB/srp: Avoid sending a task management function needlessly Bart Van Assche
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Bart Van Assche @ 2013-02-21 17:16 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: David Dillow, Or Gerlitz, Vu Pham, Sagi Grimberg
Remove an assignment that incorrectly overwrites the connection
state update by srp_connect_target().
Signed-off-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
Acked-by: David Dillow <dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
Cc: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> # 3.8
---
drivers/infiniband/ulp/srp/ib_srp.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index d5088ce..94f76b9 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1972,7 +1972,6 @@ static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
spin_unlock(&host->target_lock);
target->state = SRP_TARGET_LIVE;
- target->connected = false;
scsi_scan_target(&target->scsi_host->shost_gendev,
0, target->scsi_id, SCAN_WILD_CARD, 0);
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 2/4] IB/srp: Avoid sending a task management function needlessly
[not found] ` <51265641.4060609-HInyCGIudOg@public.gmane.org>
2013-02-21 17:16 ` [PATCH v4 1/4] IB/srp: Track connection state properly Bart Van Assche
@ 2013-02-21 17:18 ` Bart Van Assche
2013-02-21 17:19 ` [PATCH v4 3/4] IB/srp: Avoid endless SCSI error handling loop Bart Van Assche
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Bart Van Assche @ 2013-02-21 17:18 UTC (permalink / raw)
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, David Dillow,
Or Gerlitz, Vu Pham, Sagi Grimberg
Do not send a task management function if sending will fail anyway
because either there is no RDMA/RC connection or the QP is in the
error state.
Signed-off-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
Acked-by: David Dillow <dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
Cc: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> # 3.8
---
drivers/infiniband/ulp/srp/ib_srp.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 94f76b9..2633258 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1695,6 +1695,9 @@ static int srp_send_tsk_mgmt(struct srp_target_port *target,
struct srp_iu *iu;
struct srp_tsk_mgmt *tsk_mgmt;
+ if (!target->connected || target->qp_in_error)
+ return -1;
+
init_completion(&target->tsk_mgmt_done);
spin_lock_irq(&target->lock);
@@ -1754,8 +1757,6 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n");
- if (target->qp_in_error)
- return FAILED;
if (srp_send_tsk_mgmt(target, SRP_TAG_NO_REQ, scmnd->device->lun,
SRP_TSK_LUN_RESET))
return FAILED;
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 3/4] IB/srp: Avoid endless SCSI error handling loop
[not found] ` <51265641.4060609-HInyCGIudOg@public.gmane.org>
2013-02-21 17:16 ` [PATCH v4 1/4] IB/srp: Track connection state properly Bart Van Assche
2013-02-21 17:18 ` [PATCH v4 2/4] IB/srp: Avoid sending a task management function needlessly Bart Van Assche
@ 2013-02-21 17:19 ` Bart Van Assche
2013-02-21 17:20 ` [PATCH v4 4/4] IB/srp: Fail I/O requests if the transport is offline Bart Van Assche
2013-02-25 17:32 ` [PATCH v4 0/4] IB/srp fixes Roland Dreier
4 siblings, 0 replies; 8+ messages in thread
From: Bart Van Assche @ 2013-02-21 17:19 UTC (permalink / raw)
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, David Dillow,
Or Gerlitz, Vu Pham, Sagi Grimberg
If a SCSI command times out it is passed to the SCSI error
handler. The SCSI error handler will try to abort the commands
that timed out. If aborting failed a device reset will be
attempted. If the device reset also fails a host reset will
be attempted. If the host reset also fails the whole procedure
will be repeated.
srp_abort() and srp_reset_device() fail for a QP in the error
state. srp_reset_host() fails after host removal has started.
Hence if the SCSI error handler gets invoked after host removal
has started and with the QP in the error state an endless loop
will be triggered.
Modify the SCSI error handling functions in ib_srp as follows:
- Abort SCSI commands properly even if the QP is in the error
state.
- Make srp_reset_host() reset SCSI requests even after host
removal has already started or if reconnecting fails.
Signed-off-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
Acked-by: David Dillow <dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
Cc: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
Cc: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: Vu Pham <vu-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: Alex Turin <alextu-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> # 3.8
---
drivers/infiniband/ulp/srp/ib_srp.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 2633258..8a7eb9f 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -700,23 +700,24 @@ static int srp_reconnect_target(struct srp_target_port *target)
struct Scsi_Host *shost = target->scsi_host;
int i, ret;
- if (target->state != SRP_TARGET_LIVE)
- return -EAGAIN;
-
scsi_target_block(&shost->shost_gendev);
srp_disconnect_target(target);
/*
- * Now get a new local CM ID so that we avoid confusing the
- * target in case things are really fouled up.
+ * Now get a new local CM ID so that we avoid confusing the target in
+ * case things are really fouled up. Doing so also ensures that all CM
+ * callbacks will have finished before a new QP is allocated.
*/
ret = srp_new_cm_id(target);
- if (ret)
- goto unblock;
-
- ret = srp_create_target_ib(target);
- if (ret)
- goto unblock;
+ /*
+ * Whether or not creating a new CM ID succeeded, create a new
+ * QP. This guarantees that all completion callback function
+ * invocations have finished before request resetting starts.
+ */
+ if (ret == 0)
+ ret = srp_create_target_ib(target);
+ else
+ srp_create_target_ib(target);
for (i = 0; i < SRP_CMD_SQ_SIZE; ++i) {
struct srp_request *req = &target->req_ring[i];
@@ -728,9 +729,9 @@ static int srp_reconnect_target(struct srp_target_port *target)
for (i = 0; i < SRP_SQ_SIZE; ++i)
list_add(&target->tx_ring[i]->list, &target->free_tx);
- ret = srp_connect_target(target);
+ if (ret == 0)
+ ret = srp_connect_target(target);
-unblock:
scsi_target_unblock(&shost->shost_gendev, ret == 0 ? SDEV_RUNNING :
SDEV_TRANSPORT_OFFLINE);
@@ -1739,7 +1740,7 @@ static int srp_abort(struct scsi_cmnd *scmnd)
shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n");
- if (!req || target->qp_in_error || !srp_claim_req(target, req, scmnd))
+ if (!req || !srp_claim_req(target, req, scmnd))
return FAILED;
srp_send_tsk_mgmt(target, req->index, scmnd->device->lun,
SRP_TSK_ABORT_TASK);
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 4/4] IB/srp: Fail I/O requests if the transport is offline
[not found] ` <51265641.4060609-HInyCGIudOg@public.gmane.org>
` (2 preceding siblings ...)
2013-02-21 17:19 ` [PATCH v4 3/4] IB/srp: Avoid endless SCSI error handling loop Bart Van Assche
@ 2013-02-21 17:20 ` Bart Van Assche
2013-02-25 17:32 ` [PATCH v4 0/4] IB/srp fixes Roland Dreier
4 siblings, 0 replies; 8+ messages in thread
From: Bart Van Assche @ 2013-02-21 17:20 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: David Dillow, Or Gerlitz, Vu Pham, Sagi Grimberg
If an SRP target is no longer reachable and srp_reset_host()
fails to reconnect then ib_srp will invoke scsi_remove_host().
That function will invoke __scsi_remove_device() for each LUN.
And that last function will change the device state from
SDEV_TRANSPORT_OFFLINE into SDEV_CANCEL. Certain user space
software, e.g. older versions of multipathd, continue queueing
I/O to SCSI devices that are in the SDEV_CANCEL state. If these
I/O requests are submitted as SG_IO that means that the
REQ_PREEMPT flag will be set and hence that these requests will
be passed to srp_queuecommand(). These requests will time out.
If new requests are queued fast enough from user space these
active requests will prevent __scsi_remove_device() to finish.
Avoid this by failing I/O requests in the SDEV_CANCEL state if
the transport is offline. Introduce a new variable to keep
track of the transport state instead of failing requests if
(!target->connected || target->qp_in_error) such that the SCSI
error handler has a chance to retry commands after a transport
layer failure occurred.
Signed-off-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
Cc: David Dillow <dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
Cc: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: Vu Pham <vu-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> # 3.8
---
drivers/infiniband/ulp/srp/ib_srp.c | 7 +++++++
drivers/infiniband/ulp/srp/ib_srp.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 8a7eb9f..7ccf328 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -734,6 +734,7 @@ static int srp_reconnect_target(struct srp_target_port *target)
scsi_target_unblock(&shost->shost_gendev, ret == 0 ? SDEV_RUNNING :
SDEV_TRANSPORT_OFFLINE);
+ target->transport_offline = !!ret;
if (ret)
goto err;
@@ -1353,6 +1354,12 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
unsigned long flags;
int len;
+ if (unlikely(target->transport_offline)) {
+ scmnd->result = DID_NO_CONNECT << 16;
+ scmnd->scsi_done(scmnd);
+ return 0;
+ }
+
spin_lock_irqsave(&target->lock, flags);
iu = __srp_get_tx_iu(target, SRP_IU_CMD);
if (!iu)
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h
index de2d0b3..66fbedd 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.h
+++ b/drivers/infiniband/ulp/srp/ib_srp.h
@@ -140,6 +140,7 @@ struct srp_target_port {
unsigned int cmd_sg_cnt;
unsigned int indirect_size;
bool allow_ext_sg;
+ bool transport_offline;
/* Everything above this point is used in the hot path of
* command processing. Try to keep them packed into cachelines.
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/4] IB/srp fixes
[not found] ` <51265641.4060609-HInyCGIudOg@public.gmane.org>
` (3 preceding siblings ...)
2013-02-21 17:20 ` [PATCH v4 4/4] IB/srp: Fail I/O requests if the transport is offline Bart Van Assche
@ 2013-02-25 17:32 ` Roland Dreier
[not found] ` <CAL1RGDXJecgywr-xrD8r6kC4mUDECTvbhKgX3QjuC1VWGjz_kQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
4 siblings, 1 reply; 8+ messages in thread
From: Roland Dreier @ 2013-02-25 17:32 UTC (permalink / raw)
To: Bart Van Assche
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, David Dillow,
Or Gerlitz, Vu Pham, Sagi Grimberg
All look good, applied for 3.9, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/4] IB/srp fixes
[not found] ` <CAL1RGDXJecgywr-xrD8r6kC4mUDECTvbhKgX3QjuC1VWGjz_kQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-02-25 17:36 ` Or Gerlitz
[not found] ` <CAJZOPZJR4SSkOEd_zEDnt4bZC-YkNPijZwQ-W=8-dSQuM_4Avw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Or Gerlitz @ 2013-02-25 17:36 UTC (permalink / raw)
To: Roland Dreier
Cc: Bart Van Assche,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, David Dillow,
Vu Pham, Sagi Grimberg
On Mon, Feb 25, 2013 at 7:32 PM, Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org> wrote:
>
> All look good, applied for 3.9, thanks.
Roland, could you add a CC to -stable so they can get to 3.8-stable too?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/4] IB/srp fixes
[not found] ` <CAJZOPZJR4SSkOEd_zEDnt4bZC-YkNPijZwQ-W=8-dSQuM_4Avw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-02-25 17:41 ` Or Gerlitz
0 siblings, 0 replies; 8+ messages in thread
From: Or Gerlitz @ 2013-02-25 17:41 UTC (permalink / raw)
To: Roland Dreier
Cc: Bart Van Assche,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, David Dillow,
Vu Pham, Sagi Grimberg
On Mon, Feb 25, 2013 at 7:36 PM, Or Gerlitz <or.gerlitz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Mon, Feb 25, 2013 at 7:32 PM, Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org> wrote:
>> All look good, applied for 3.9, thanks.
> Roland, could you add a CC to -stable so they can get to 3.8-stable too?
Oh, I see its just there, thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-02-25 17:41 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-21 17:15 [PATCH v4 0/4] IB/srp fixes Bart Van Assche
[not found] ` <51265641.4060609-HInyCGIudOg@public.gmane.org>
2013-02-21 17:16 ` [PATCH v4 1/4] IB/srp: Track connection state properly Bart Van Assche
2013-02-21 17:18 ` [PATCH v4 2/4] IB/srp: Avoid sending a task management function needlessly Bart Van Assche
2013-02-21 17:19 ` [PATCH v4 3/4] IB/srp: Avoid endless SCSI error handling loop Bart Van Assche
2013-02-21 17:20 ` [PATCH v4 4/4] IB/srp: Fail I/O requests if the transport is offline Bart Van Assche
2013-02-25 17:32 ` [PATCH v4 0/4] IB/srp fixes Roland Dreier
[not found] ` <CAL1RGDXJecgywr-xrD8r6kC4mUDECTvbhKgX3QjuC1VWGjz_kQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-25 17:36 ` Or Gerlitz
[not found] ` <CAJZOPZJR4SSkOEd_zEDnt4bZC-YkNPijZwQ-W=8-dSQuM_4Avw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-25 17:41 ` Or Gerlitz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.