From patchwork Mon Nov 26 04:44:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Dillow X-Patchwork-Id: 1800241 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 B90D33FC54 for ; Mon, 26 Nov 2012 04:55:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754149Ab2KZEzP (ORCPT ); Sun, 25 Nov 2012 23:55:15 -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 S1753904Ab2KZEzH (ORCPT ); Sun, 25 Nov 2012 23:55:07 -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 qAQ4iJ6W013693 (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 qAQ4iJNe005436 (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 qAQ4iIDU024523; Sun, 25 Nov 2012 23:44:18 -0500 Received: (from dad@localhost) by obelisk.thedillows.org (8.14.5/8.14.5/Submit) id qAQ4iIwJ024522; Sun, 25 Nov 2012 23:44:18 -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 03/11] IB/srp: don't send anything on a bad QP Date: Sun, 25 Nov 2012 23:44:08 -0500 Message-Id: <90b21916a384281682d520302b594834e010671b.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 Once we know we have an issue with the QP, there is no point trying to send anything else down the pipe. This also allows us to consolidate code in the SCSI EH path. Needs-to-be-signed-off-by: Bart Van Assche [ adapted to new state tracking code ] Signed-off-by: David Dillow --- drivers/infiniband/ulp/srp/ib_srp.c | 21 ++++++++------------- 1 files changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 1e8ce81..2951e1c 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1328,14 +1328,12 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd) int len; if (unlikely(target->state)) { - if (srp_is_disconnected(target)) + if (!srp_is_removed(target)) goto err; - if (srp_is_removed(target)) { - scmnd->result = DID_BAD_TARGET << 16; - scmnd->scsi_done(scmnd); - return 0; - } + scmnd->result = DID_BAD_TARGET << 16; + scmnd->scsi_done(scmnd); + return 0; } spin_lock_irqsave(&target->lock, flags); @@ -1683,7 +1681,7 @@ static int srp_send_tsk_mgmt(struct srp_target_port *target, struct srp_iu *iu; struct srp_tsk_mgmt *tsk_mgmt; - if (srp_is_removed(target)) + if (target->state) return -1; init_completion(&target->tsk_mgmt_done); @@ -1727,12 +1725,11 @@ static int srp_abort(struct scsi_cmnd *scmnd) shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n"); - if (srp_in_error(target)) - return FAILED; if (!req || !srp_claim_req(target, req, scmnd)) return FAILED; - srp_send_tsk_mgmt(target, req->index, scmnd->device->lun, - SRP_TSK_ABORT_TASK); + if (srp_send_tsk_mgmt(target, req->index, scmnd->device->lun, + SRP_TSK_ABORT_TASK)) + return FAILED; srp_free_req(target, req, scmnd, 0); scmnd->result = DID_ABORT << 16; scmnd->scsi_done(scmnd); @@ -1747,8 +1744,6 @@ static int srp_reset_device(struct scsi_cmnd *scmnd) shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n"); - if (srp_in_error(target)) - return FAILED; if (srp_send_tsk_mgmt(target, SRP_TAG_NO_REQ, scmnd->device->lun, SRP_TSK_LUN_RESET)) return FAILED;