Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1394174ybz; Thu, 16 Apr 2020 08:24:30 -0700 (PDT) X-Google-Smtp-Source: APiQypIds8pD8CDHPa5Sb3JkTVVxmbq3weh/paSQHGbTejHZljSpSGP/zI2+G2iaCk7mnOuT5vbz X-Received: by 2002:a17:906:18a2:: with SMTP id c2mr10372543ejf.167.1587050669921; Thu, 16 Apr 2020 08:24:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587050669; cv=none; d=google.com; s=arc-20160816; b=F1FB+1CMYmaQG9qwlLhI9Xdbvxsj0OI9Ye7zM7uyOHaznfyxZH5VijulgxPCAg22zE 9sJbn5um4N6B20cQ+IYVK1z0cpBbzRA/eQ+rEbhdtE3fW3FjUWyc++f4v/L9/MmXW7JL 0IAmNunW7v+4fL68Dsa0cu+BOjTRH7SABdytb8OI0tMEQnZfW/Zm8pQ0G70QmgTTSs70 mXH9nwu5W+NezG9u9o3Os7CdjIHUieE8o9NB3nxhKNOo/pyDJZDeXzHfgtlpB+t9MFHm N/b/EbGQnbN1jeuJYltGTv3M8lrH1E3M5whXnkGBni73fmO2PaO6qrJ0nwyc7hGXcEH+ zAyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wl5fYcvBggUiCE8lujblkmqUAW+3YaO2HlVrA14GMOg=; b=cMgd7/VO36cmmGO0lTfFPQ0iHQChYPwTcv3ojLTX9xdmDBSARXzMR5UgUfVIYI4SdA NybiJ8DFKPVuflXxVxBdgj2gzG/ZgNU+xLHM99Ckxz2kYnzIgq8ESYICuZnxhRtz8W1a 5hym+er4nm0MYdvpfbKM+J9x/kQj+DmeC1tvdr+3ISaXXOX+NaNyo1rFCpFUQKJc5aSD VH+tbsjfgxLF1ZOlDCLSez75rTWk4AqbWL6RcTXZE1F+PEdkV+uLJVz5z0G2yooSgPQ7 yY0Ruw7G7zEGWU+iwTqZ71H45dzJbWAf1v+6exCPdJ1FM03irWaAZyNpWi21IcJsK33O jHJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Pn06r5hF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v14si9850669edb.37.2020.04.16.08.24.05; Thu, 16 Apr 2020 08:24:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Pn06r5hF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2409208AbgDPPWC (ORCPT + 99 others); Thu, 16 Apr 2020 11:22:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:60118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2898562AbgDPNqQ (ORCPT ); Thu, 16 Apr 2020 09:46:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3B7EF20732; Thu, 16 Apr 2020 13:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587044774; bh=oC1yYeTCASyOsmvAUaZpZuS7X+KrPBxdHJ7CSAu80BM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pn06r5hFdjCYz52ff4OlYi7WtFhlPf5fZpbaaT64vcvPLKJADlagoTRr/0tHV2pVU DyGSgv3673Vp2jt0QwZ2PSTzbHHZv5ptUelsnzDGCQKHs5Ob7h9JdF8DiGFRkuAlnb I3dxp/2YPjWZKV3KfoKisa06f9RMKzuL7cO7Zk+8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Smart , Himanshu Madhani , Christoph Hellwig Subject: [PATCH 5.4 097/232] nvme-fc: Revert "add module to ops template to allow module references" Date: Thu, 16 Apr 2020 15:23:11 +0200 Message-Id: <20200416131327.128072640@linuxfoundation.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200416131316.640996080@linuxfoundation.org> References: <20200416131316.640996080@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Smart commit 8c5c660529209a0e324c1c1a35ce3f83d67a2aa5 upstream. The original patch was to resolve the lldd being able to be unloaded while being used to talk to the boot device of the system. However, the end result of the original patch is that any driver unload while a nvme controller is live via the lldd is now being prohibited. Given the module reference, the module teardown routine can't be called, thus there's no way, other than manual actions to terminate the controllers. Fixes: 863fbae929c7 ("nvme_fc: add module to ops template to allow module references") Cc: # v5.4+ Signed-off-by: James Smart Reviewed-by: Himanshu Madhani Signed-off-by: Christoph Hellwig Signed-off-by: Greg Kroah-Hartman --- drivers/nvme/host/fc.c | 14 ++------------ drivers/nvme/target/fcloop.c | 1 - drivers/scsi/lpfc/lpfc_nvme.c | 2 -- drivers/scsi/qla2xxx/qla_nvme.c | 1 - include/linux/nvme-fc-driver.h | 4 ---- 5 files changed, 2 insertions(+), 20 deletions(-) --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -342,8 +342,7 @@ nvme_fc_register_localport(struct nvme_f !template->ls_req || !template->fcp_io || !template->ls_abort || !template->fcp_abort || !template->max_hw_queues || !template->max_sgl_segments || - !template->max_dif_sgl_segments || !template->dma_boundary || - !template->module) { + !template->max_dif_sgl_segments || !template->dma_boundary) { ret = -EINVAL; goto out_reghost_failed; } @@ -2016,7 +2015,6 @@ nvme_fc_ctrl_free(struct kref *ref) { struct nvme_fc_ctrl *ctrl = container_of(ref, struct nvme_fc_ctrl, ref); - struct nvme_fc_lport *lport = ctrl->lport; unsigned long flags; if (ctrl->ctrl.tagset) { @@ -2043,7 +2041,6 @@ nvme_fc_ctrl_free(struct kref *ref) if (ctrl->ctrl.opts) nvmf_free_options(ctrl->ctrl.opts); kfree(ctrl); - module_put(lport->ops->module); } static void @@ -3071,15 +3068,10 @@ nvme_fc_init_ctrl(struct device *dev, st goto out_fail; } - if (!try_module_get(lport->ops->module)) { - ret = -EUNATCH; - goto out_free_ctrl; - } - idx = ida_simple_get(&nvme_fc_ctrl_cnt, 0, 0, GFP_KERNEL); if (idx < 0) { ret = -ENOSPC; - goto out_mod_put; + goto out_free_ctrl; } ctrl->ctrl.opts = opts; @@ -3232,8 +3224,6 @@ out_free_queues: out_free_ida: put_device(ctrl->dev); ida_simple_remove(&nvme_fc_ctrl_cnt, ctrl->cnum); -out_mod_put: - module_put(lport->ops->module); out_free_ctrl: kfree(ctrl); out_fail: --- a/drivers/nvme/target/fcloop.c +++ b/drivers/nvme/target/fcloop.c @@ -850,7 +850,6 @@ fcloop_targetport_delete(struct nvmet_fc #define FCLOOP_DMABOUND_4G 0xFFFFFFFF static struct nvme_fc_port_template fctemplate = { - .module = THIS_MODULE, .localport_delete = fcloop_localport_delete, .remoteport_delete = fcloop_remoteport_delete, .create_queue = fcloop_create_queue, --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -1976,8 +1976,6 @@ out_unlock: /* Declare and initialization an instance of the FC NVME template. */ static struct nvme_fc_port_template lpfc_nvme_template = { - .module = THIS_MODULE, - /* initiator-based functions */ .localport_delete = lpfc_nvme_localport_delete, .remoteport_delete = lpfc_nvme_remoteport_delete, --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -610,7 +610,6 @@ static void qla_nvme_remoteport_delete(s } static struct nvme_fc_port_template qla_nvme_fc_transport = { - .module = THIS_MODULE, .localport_delete = qla_nvme_localport_delete, .remoteport_delete = qla_nvme_remoteport_delete, .create_queue = qla_nvme_alloc_queue, --- a/include/linux/nvme-fc-driver.h +++ b/include/linux/nvme-fc-driver.h @@ -270,8 +270,6 @@ struct nvme_fc_remote_port { * * Host/Initiator Transport Entrypoints/Parameters: * - * @module: The LLDD module using the interface - * * @localport_delete: The LLDD initiates deletion of a localport via * nvme_fc_deregister_localport(). However, the teardown is * asynchronous. This routine is called upon the completion of the @@ -385,8 +383,6 @@ struct nvme_fc_remote_port { * Value is Mandatory. Allowed to be zero. */ struct nvme_fc_port_template { - struct module *module; - /* initiator-based functions */ void (*localport_delete)(struct nvme_fc_local_port *); void (*remoteport_delete)(struct nvme_fc_remote_port *);