From patchwork Wed Nov 16 08:54:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satish Kharat X-Patchwork-Id: 9431115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E432E6021C for ; Wed, 16 Nov 2016 09:03:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D329928509 for ; Wed, 16 Nov 2016 09:03:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C545428EB1; Wed, 16 Nov 2016 09:03:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEFEF28509 for ; Wed, 16 Nov 2016 09:03:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752805AbcKPJDw (ORCPT ); Wed, 16 Nov 2016 04:03:52 -0500 Received: from alln-iport-4.cisco.com ([173.37.142.91]:4252 "EHLO alln-iport-4.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752352AbcKPJDv (ORCPT ); Wed, 16 Nov 2016 04:03:51 -0500 X-Greylist: delayed 578 seconds by postgrey-1.27 at vger.kernel.org; Wed, 16 Nov 2016 04:03:51 EST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1944; q=dns/txt; s=iport; t=1479287031; x=1480496631; h=from:to:cc:subject:date:message-id; bh=KAdbQVPilJevxav1RDYnzL8+dPHKr1pe1vs93rZyRAU=; b=llY8761QL4qYtenaGDn8+dZW1fid5Aqcskl1CCWxX7afo/EjUJ0nG7oz hq85UDECIyyYtZXxmpR09H2mt8l10EPCCzzy2DpUCmDjoHi4NDknXFvx3 o4G/UeHvVDeyoEOgewzRLjxdCAOUe0+T/IM9CmZIcTGMVS9JbkztikZ7K A=; X-IronPort-AV: E=Sophos;i="5.31,647,1473120000"; d="scan'208";a="348179012" Received: from alln-core-3.cisco.com ([173.36.13.136]) by alln-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 16 Nov 2016 08:54:12 +0000 Received: from satishkh.localdomain (satish-desk-server.cisco.com [10.193.101.66]) by alln-core-3.cisco.com (8.14.5/8.14.5) with ESMTP id uAG8sBuR007204; Wed, 16 Nov 2016 08:54:11 GMT From: Satish Kharat To: satishkh@cisco.com, linux-scsi@vger.kernel.org, thenzl@redhat.com Cc: Sesidhar Baddela Subject: [PATCH] fnic: Correcting rport check location in fnic_queuecommand_lck Date: Wed, 16 Nov 2016 00:54:01 -0800 Message-Id: <1479286441-8243-1-git-send-email-satishkh@cisco.com> X-Mailer: git-send-email 2.5.5 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Satish Kharat Signed-off-by: Sesidhar Baddela Reviewed-by: Tomas Henzl --- drivers/scsi/fnic/fnic_scsi.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index bfaba06..2544a37 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c @@ -441,30 +441,38 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_ unsigned long ptr; spinlock_t *io_lock = NULL; int io_lock_acquired = 0; + struct fc_rport_libfc_priv *rp; if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED))) return SCSI_MLQUEUE_HOST_BUSY; rport = starget_to_rport(scsi_target(sc->device)); + if (!rport) { + FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, + "returning DID_NO_CONNECT for IO as rport is NULL\n"); + sc->result = DID_NO_CONNECT << 16; + done(sc); + return 0; + } + ret = fc_remote_port_chkready(rport); if (ret) { + FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, + "rport is not ready\n"); atomic64_inc(&fnic_stats->misc_stats.rport_not_ready); sc->result = ret; done(sc); return 0; } - if (rport) { - struct fc_rport_libfc_priv *rp = rport->dd_data; - - if (!rp || rp->rp_state != RPORT_ST_READY) { - FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, + rp = rport->dd_data; + if (!rp || rp->rp_state != RPORT_ST_READY) { + FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "returning DID_NO_CONNECT for IO as rport is removed\n"); - atomic64_inc(&fnic_stats->misc_stats.rport_not_ready); - sc->result = DID_NO_CONNECT<<16; - done(sc); - return 0; - } + atomic64_inc(&fnic_stats->misc_stats.rport_not_ready); + sc->result = DID_NO_CONNECT<<16; + done(sc); + return 0; } if (lp->state != LPORT_ST_READY || !(lp->link_up))