From patchwork Mon Nov 26 04:44:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Dillow X-Patchwork-Id: 1800211 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id DA8B63FC54 for ; Mon, 26 Nov 2012 04:55:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754206Ab2KZEzI (ORCPT ); Sun, 25 Nov 2012 23:55:08 -0500 Received: from matrix.voodoobox.net ([75.127.97.206]:38059 "EHLO matrix.voodoobox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754142Ab2KZEzG (ORCPT ); Sun, 25 Nov 2012 23:55:06 -0500 X-Greylist: delayed 640 seconds by postgrey-1.27 at vger.kernel.org; Sun, 25 Nov 2012 23:55:05 EST Received: from shed.thedillows.org ([IPv6:2001:470:8:bf8:218:f3ff:fe04:4c7d]) by matrix.voodoobox.net (8.13.8/8.13.8) with ESMTP id qAQ4iKs6013696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 25 Nov 2012 23:44:20 -0500 Received: from obelisk.thedillows.org (obelisk.thedillows.org [192.168.0.10]) by shed.thedillows.org (8.14.4/8.14.4) with ESMTP id qAQ4iJZX005439 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 25 Nov 2012 23:44:19 -0500 Received: from obelisk.thedillows.org (localhost [127.0.0.1]) by obelisk.thedillows.org (8.14.5/8.14.4) with ESMTP id qAQ4iJw0024527; Sun, 25 Nov 2012 23:44:19 -0500 Received: (from dad@localhost) by obelisk.thedillows.org (8.14.5/8.14.5/Submit) id qAQ4iJsv024526; Sun, 25 Nov 2012 23:44:19 -0500 X-Authentication-Warning: obelisk.thedillows.org: dad set sender to dillowda@ornl.gov using -f From: David Dillow To: linux-rdma@vger.kernel.org Cc: linux-scsi@vger.kernel.org, bvanassche@acm.org, roland@purestorage.com Subject: [PATCH 04/11] IB/srp: keep processing commands during host removal Date: Sun, 25 Nov 2012 23:44:09 -0500 Message-Id: <8715294a23dded5879b3a327c470d9b6a39ddbc4.1353903448.git.dillowda@ornl.gov> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: References: In-Reply-To: References: Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Bart Van Assche 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 [ adapted to new state tracking ] Signed-off-by: David Dillow --- 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);