From patchwork Thu Mar 17 07:51:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narsimhulu Musini X-Patchwork-Id: 8607661 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 072419F44D for ; Thu, 17 Mar 2016 07:57:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3909E20279 for ; Thu, 17 Mar 2016 07:57:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 43E8A202E6 for ; Thu, 17 Mar 2016 07:57:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932692AbcCQH5l (ORCPT ); Thu, 17 Mar 2016 03:57:41 -0400 Received: from alln-iport-8.cisco.com ([173.37.142.95]:11617 "EHLO alln-iport-8.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932663AbcCQH5i (ORCPT ); Thu, 17 Mar 2016 03:57:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1590; q=dns/txt; s=iport; t=1458201458; x=1459411058; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=WzKcgR5wwIysEG06UA1CjmHNyfGVpXQ8yc/wK0fwPnQ=; b=iGHwahn4/FTBt3qFbgePRPj1X1UuHtjX+4N+mWfJ8OCNSdCdauqL2/+R z4Ts/9w+dA5/e2P3LQ5c453pV7iElMcaamar1eDLzOorCAqJYMhMkC9Vy fW/T5yXCSposgFJpRKY08J/y8UGvHN2/Ytv+Gh/hjcll7ba8NioZlgsAR Y=; X-IronPort-AV: E=Sophos;i="5.24,349,1454976000"; d="scan'208";a="250215930" Received: from rcdn-core-1.cisco.com ([173.37.93.152]) by alln-iport-8.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Mar 2016 07:57:36 +0000 Received: from hishah-lnx.cisco.com (dhcp-171-71-13-47.cisco.com [171.71.13.47]) (authenticated bits=0) by rcdn-core-1.cisco.com (8.14.5/8.14.5) with ESMTP id u2H7vTYc012243 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 17 Mar 2016 07:57:36 GMT From: Narsimhulu Musini To: James.Bottomley@HansenPartnership.com, linux-scsi@vger.kernel.org, hare@suse.de Cc: Narsimhulu Musini , Sesidhar Baddela Subject: [PATCH 4/8] snic: target cleanup in driver unload path Date: Thu, 17 Mar 2016 00:51:13 -0700 Message-Id: <1458201077-10211-4-git-send-email-nmusini@cisco.com> X-Mailer: git-send-email 1.8.5.4 In-Reply-To: <1458201077-10211-1-git-send-email-nmusini@cisco.com> References: <1458201077-10211-1-git-send-email-nmusini@cisco.com> X-Authenticated-User: nmusini@cisco.com Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY, USER_IN_DEF_DKIM_WL autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix deletes the snic targets synchronously prior to deletion of host. Signed-off-by: Narsimhulu Musini Signed-off-by: Sesidhar Baddela --- drivers/scsi/snic/snic_disc.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/snic/snic_disc.c b/drivers/scsi/snic/snic_disc.c index 5f63217..c46960c 100644 --- a/drivers/scsi/snic/snic_disc.c +++ b/drivers/scsi/snic/snic_disc.c @@ -480,10 +480,21 @@ int snic_disc_start(struct snic *snic) { struct snic_disc *disc = &snic->disc; + unsigned long flags; int ret = 0; SNIC_SCSI_DBG(snic->shost, "Discovery Start.\n"); + spin_lock_irqsave(&snic->snic_lock, flags); + if (snic->in_remove) { + spin_unlock_irqrestore(&snic->snic_lock, flags); + SNIC_ERR("snic driver removal in progress ...\n"); + ret = 0; + + return ret; + } + spin_unlock_irqrestore(&snic->snic_lock, flags); + mutex_lock(&disc->mutex); if (disc->state == SNIC_DISC_PENDING) { disc->req_cnt++; @@ -533,6 +544,8 @@ snic_tgt_del_all(struct snic *snic) struct list_head *cur, *nxt; unsigned long flags; + scsi_flush_work(snic->shost); + mutex_lock(&snic->disc.mutex); spin_lock_irqsave(snic->shost->host_lock, flags); @@ -545,7 +558,7 @@ snic_tgt_del_all(struct snic *snic) tgt = NULL; } spin_unlock_irqrestore(snic->shost->host_lock, flags); - - scsi_flush_work(snic->shost); mutex_unlock(&snic->disc.mutex); + + flush_workqueue(snic_glob->event_q); } /* end of snic_tgt_del_all */