linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
To: David Dillow <dillowda-1Heg1YXhbW8@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org
Subject: Re: [PATCH 04/11] IB/srp: keep processing commands during host removal
Date: Mon, 26 Nov 2012 10:43:36 +0100	[thread overview]
Message-ID: <50B339C8.2000104@acm.org> (raw)
In-Reply-To: <8715294a23dded5879b3a327c470d9b6a39ddbc4.1353903448.git.dillowda-1Heg1YXhbW8@public.gmane.org>

On 11/26/12 05:44, David Dillow wrote:
> From: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
> 
> Some SCSI upper layer drivers, e.g. sd, issue SCSI commands from
> inside scsi_remove_host() (see also the sd_shutdown() call in
> sd_remove()). Make sure that these commands have a chance to reach
> the SCSI device.
> 
> Signed-off-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
> [ adapted to new state tracking ]
> Signed-off-by: David Dillow <dillowda-1Heg1YXhbW8@public.gmane.org>
> ---
>   drivers/infiniband/ulp/srp/ib_srp.c |   11 ++++++-----
>   1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index 2951e1c..f7d7e6a 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -1328,12 +1328,13 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
>   	int len;
>   
>   	if (unlikely(target->state)) {
> -		if (!srp_is_removed(target))
> +		/*
> +		 * Only requeue commands if we cannot send them to the target.
> +		 * We'll let commands through during shutdown so that caches
> +		 * get flushed, etc.
> +		 */
> +		if (srp_is_disconnected(target) || srp_in_error(target))
>   			goto err;
> -
> -		scmnd->result = DID_BAD_TARGET << 16;
> -		scmnd->scsi_done(scmnd);
> -		return 0;
>   	}
>   
>   	spin_lock_irqsave(&target->lock, flags);

Hi Dave,

After I posted the patch on which the above patch has been based I
realized that it can be simplified. Since the patch called "Eliminate
state SRP_TARGET_CONNECTING" blocks the SCSI host as long as the RDMA
RC connection is being reconnected srp_queuecommand() won't be invoked
during the "disconnected" or "error" state. How about adding the patch
below just after the patch that eliminates the state
SRP_TARGET_CONNECTING ?

Bart.

 
[PATCH] ib_srp: Keep processing commands during host removal

Some SCSI upper layer drivers, e.g. sd, issue SCSI commands from
inside scsi_remove_host(). See also the sd_shutdown() call in
sd_remove(). Make sure that these commands have a chance to reach
the SCSI device.

Signed-off-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
---
 drivers/infiniband/ulp/srp/ib_srp.c |    7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 39723e7..03b9fa0 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1324,13 +1324,6 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
 	unsigned long flags;
 	int len;
 
-	if (target->state == SRP_TARGET_DEAD ||
-	    target->state == SRP_TARGET_REMOVED) {
-		scmnd->result = DID_BAD_TARGET << 16;
-		scmnd->scsi_done(scmnd);
-		return 0;
-	}
-
 	spin_lock_irqsave(&target->lock, flags);
 	iu = __srp_get_tx_iu(target, SRP_IU_CMD);
 	if (!iu)
-- 
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

  parent reply	other threads:[~2012-11-26  9:43 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-26  4:44 [PATCH 00/11] First pass at merging Bart's HA work David Dillow
2012-11-26  4:44 ` [PATCH 01/11] IB/srp: enlarge block layer timeout David Dillow
2012-11-26  4:44 ` [PATCH 02/11] IB/srp: simplify state tracking David Dillow
2012-11-26  9:46   ` Bart Van Assche
     [not found]     ` <50B33A91.3060103-HInyCGIudOg@public.gmane.org>
2012-11-27  3:56       ` David Dillow
     [not found] ` <cover.1353903448.git.dillowda-1Heg1YXhbW8@public.gmane.org>
2012-11-26  4:44   ` [PATCH 03/11] IB/srp: don't send anything on a bad QP David Dillow
2012-11-26  9:17     ` Bart Van Assche
     [not found]       ` <50B333AF.6040509-HInyCGIudOg@public.gmane.org>
2012-11-27  3:31         ` David Dillow
2012-11-26  4:44   ` [PATCH 04/11] IB/srp: keep processing commands during host removal David Dillow
     [not found]     ` <8715294a23dded5879b3a327c470d9b6a39ddbc4.1353903448.git.dillowda-1Heg1YXhbW8@public.gmane.org>
2012-11-26  9:43       ` Bart Van Assche [this message]
2012-11-27  3:16         ` David Dillow
2012-11-26  4:44   ` [PATCH 08/11] srp_transport: Fix attribute registration David Dillow
2012-11-26  4:44   ` [PATCH 09/11] srp_transport: Simplify attribute initialization code David Dillow
2012-11-26  5:02     ` David Dillow
2012-11-26  4:44   ` [PATCH 11/11] IB/srp: Allow SRP disconnect through sysfs David Dillow
2012-11-26  4:44 ` [PATCH 05/11] IB/srp: destroy and recreate QP and CQs on each connection David Dillow
     [not found]   ` <8fa9a268ec4dc587970161efe94968f3263aad3b.1353903448.git.dillowda-1Heg1YXhbW8@public.gmane.org>
2012-11-26 18:57     ` Bart Van Assche
2012-11-26  4:44 ` [PATCH 06/11] IB/srp: send disconnect request without waiting for CM timewait exit David Dillow
2012-11-26  4:44 ` [PATCH 07/11] IB/srp: Document sysfs attributes David Dillow
2012-11-26  4:44 ` [PATCH 10/11] srp_transport: " David Dillow
2012-11-26  7:57 ` [PATCH 00/11] First pass at merging Bart's HA work Or Gerlitz
2012-11-27  4:53   ` David Dillow
2012-11-26 18:50 ` Roland Dreier
2012-11-26 19:15   ` James Bottomley
2012-11-26 19:22     ` Roland Dreier
2012-11-27  4:04     ` David Dillow
     [not found]       ` <1353989041.28917.24.camel-1q1vX8mYZiGLUyTwlgNVppKKF0rrzTr+@public.gmane.org>
2012-11-27  6:42         ` Or Gerlitz
2012-11-29 20:21       ` Roland Dreier
     [not found]         ` <CAL1RGDXpdWL_r7sWp=vvvXH4jxFgjDL+XcEGgKo-44=wrOBmtA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-30  2:21           ` David Dillow
2012-12-05 18:23             ` Or Gerlitz
     [not found]               ` <CAJZOPZJBTRXftrW5NWEEHnf2QWsni0HMTAV_PKSgDtA7GO=wRw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-05 18:50                 ` Bart Van Assche
     [not found]                   ` <50BF9760.2080801-HInyCGIudOg@public.gmane.org>
2012-12-05 19:50                     ` Bart Van Assche
2012-12-05 21:32                     ` Or Gerlitz
2012-12-06 14:10                       ` Bart Van Assche
     [not found]                         ` <50C0A76C.20500-HInyCGIudOg@public.gmane.org>
2012-12-06 14:27                           ` Or Gerlitz
     [not found]                             ` <50C0AB42.8040402-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-12-06 15:04                               ` Bart Van Assche
     [not found]                                 ` <50C0B407.4010706-HInyCGIudOg@public.gmane.org>
2012-12-06 15:46                                   ` Or Gerlitz
2012-12-06 15:55                                   ` Alex Turin
     [not found]                                     ` <50C0BFE0.909-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-12-07 21:47                                       ` Vu Pham
2012-12-07  8:19                               ` Or Gerlitz
2012-11-27 16:34 ` Bart Van Assche
     [not found]   ` <50B4EBA3.7070400-HInyCGIudOg@public.gmane.org>
2012-11-27 18:10     ` Joseph Glanville

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50B339C8.2000104@acm.org \
    --to=bvanassche-hinycgiudog@public.gmane.org \
    --cc=dillowda-1Heg1YXhbW8@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).