From patchwork Wed Dec 14 21:20:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satish Kharat X-Patchwork-Id: 9474725 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 463A1607EE for ; Wed, 14 Dec 2016 21:21:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36F7728680 for ; Wed, 14 Dec 2016 21:21:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A28528716; Wed, 14 Dec 2016 21:21:32 +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 BF87228680 for ; Wed, 14 Dec 2016 21:21:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756806AbcLNVVK (ORCPT ); Wed, 14 Dec 2016 16:21:10 -0500 Received: from alln-iport-2.cisco.com ([173.37.142.89]:46052 "EHLO alln-iport-2.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756681AbcLNVVJ (ORCPT ); Wed, 14 Dec 2016 16:21:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1980; q=dns/txt; s=iport; t=1481750469; x=1482960069; h=from:to:cc:subject:date:message-id; bh=OmV4633D/5mpkViOCv7JRCnYGSRrTrZSIShOnTsWg3M=; b=T5lIOBUqG8sxB6pcfPHtTJV0Y6ZxcQL8fKlXZujQn0b7vfAP9jrXhnqC us8/TfbVMUgnScQWuyxrmTgtU4PNkCf4CvGq4FyEDiS4xpGQroxyc2Su+ DcC4bR8wLAnKGCSXfmDiR/mwSWudmkzJSQd3Bs8ngsNowxUCkizq9fmCv 4=; X-IronPort-AV: E=Sophos;i="5.33,348,1477958400"; d="scan'208";a="359485242" Received: from alln-core-2.cisco.com ([173.36.13.135]) by alln-iport-2.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 14 Dec 2016 21:21:05 +0000 Received: from satishkh.localdomain (satish-desk-server.cisco.com [10.193.101.66]) by alln-core-2.cisco.com (8.14.5/8.14.5) with ESMTP id uBELL4wd031431; Wed, 14 Dec 2016 21:21:04 GMT From: Satish Kharat To: satishkh@cisco.com, linux-scsi@vger.kernel.org Cc: Sesidhar Baddela Subject: [PATCH 1/1] scsi:fnic Avoid sending reset to fnic firmware when another reset is already in progress Date: Wed, 14 Dec 2016 13:20:41 -0800 Message-Id: <1481750441-15755-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 This fix is to avoid calling fnic_fw_reset_handler through fnic_host_reset when a finc reset is alreay in progress. Signed-off-by: Satish Kharat Signed-off-by: Sesidhar Baddela --- drivers/scsi/fnic/fnic.h | 1 + drivers/scsi/fnic/fnic_scsi.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h index 9ddc920..9e4b770 100644 --- a/drivers/scsi/fnic/fnic.h +++ b/drivers/scsi/fnic/fnic.h @@ -248,6 +248,7 @@ struct fnic { struct completion *remove_wait; /* device remove thread blocks */ atomic_t in_flight; /* io counter */ + bool internal_reset_inprogress; u32 _reserved; /* fill hole */ unsigned long state_flags; /* protected by host lock */ enum fnic_state state; diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index 2544a37..adb3d58 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c @@ -2581,6 +2581,19 @@ int fnic_host_reset(struct scsi_cmnd *sc) unsigned long wait_host_tmo; struct Scsi_Host *shost = sc->device->host; struct fc_lport *lp = shost_priv(shost); + struct fnic *fnic = lport_priv(lp); + unsigned long flags; + + spin_lock_irqsave(&fnic->fnic_lock, flags); + if (fnic->internal_reset_inprogress == 0) { + fnic->internal_reset_inprogress = 1; + } else { + spin_unlock_irqrestore(&fnic->fnic_lock, flags); + FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, + "host reset in progress skipping another host reset\n"); + return SUCCESS; + } + spin_unlock_irqrestore(&fnic->fnic_lock, flags); /* * If fnic_reset is successful, wait for fabric login to complete @@ -2601,6 +2614,9 @@ int fnic_host_reset(struct scsi_cmnd *sc) } } + spin_lock_irqsave(&fnic->fnic_lock, flags); + fnic->internal_reset_inprogress = 0; + spin_unlock_irqrestore(&fnic->fnic_lock, flags); return ret; }