From patchwork Sun Oct 29 01:14:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 10031193 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 22AD260249 for ; Sun, 29 Oct 2017 01:15:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 145562883D for ; Sun, 29 Oct 2017 01:15:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 090152888D; Sun, 29 Oct 2017 01:15:09 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 668A72883D for ; Sun, 29 Oct 2017 01:15:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751737AbdJ2BPH (ORCPT ); Sat, 28 Oct 2017 21:15:07 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:46456 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751582AbdJ2BPF (ORCPT ); Sat, 28 Oct 2017 21:15:05 -0400 Received: by mail-pg0-f68.google.com with SMTP id k7so8244854pga.3 for ; Sat, 28 Oct 2017 18:15:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MbtoMGQDAHSCpmbTZbdRwjyKoO1lp/1N5GHLVwYjnUI=; b=BI8yDHurvKCfmDl01wG7qckoe7kdtbWjR6sDmthtLBUcdeUSlqQPOrwGiS/kltTULd /rYQbAuZCYj5Bao04Gf9fJdbd4CXec0TzqIr8pJLQHQTpIVDrGfFOHV3MYaOG0L5Wv3J a2/RoZjWurO8bJ5qF0y0JHyKSiIyIUtLIGL7GF5vALWHsEJlZ2IR9fYSi/YmQT5PoZrX PXoAUyx2cpaxSp95jRfGTJuiBdPiJ3uiShGg4vQgaOC0HiB/ibRrJ4U2Vc7/b8iaZEZa OivYwjrNg3cUlPIYETKTYjuR3D/D671K8ADtG3S1NTs+WziMdrwyDPDke2i3arC8jCTW J3+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MbtoMGQDAHSCpmbTZbdRwjyKoO1lp/1N5GHLVwYjnUI=; b=HWk4QbhzMqW+MZBajrVbCGvfKpD5AIz0Zk7XUOcSwsUM9w2viQEVW3bb9tlhI3PJ9Q O0YtydPUwnq1I/3Lp4m1XuMPcq/lJTddNfkUjr62QVdAMqzTXP/hjj6I4Fz+oVkFu5WV MLCQlBSSe0xvmZW7v2ZNv6yhG2l7VG2M9X1jHP5a7zhLEZH6kUkSxFvfRU0aue8MVp9U CvQu1iotJ0IHJiMfmLbteBlhyGVKyLMdtKqOmET66xhyahur3jiB3iCDHAsWuFqnOqqX hYTaAfw7D0ch9e8XX3404AO8UMqzX8Aj+bRrYTWp9hBWc2nINLMyAxSyud+9IuwraiYx uAEQ== X-Gm-Message-State: AMCzsaUeB77kY1KZFIopCxIiSdOoDgFpMBD8HRcLD/QYuAIeyASWsDIe CcMJ10m+yBu7YFvlNI92x4a+Xw== X-Google-Smtp-Source: ABhQp+TZQBQbGdleaQ+6t9NWVEyER+wWtnVnqHXRf5WELNVtcM60TjaP9Ll0MCFVN6BSzRAuWJpNjA== X-Received: by 10.98.207.71 with SMTP id b68mr4626034pfg.125.1509239704348; Sat, 28 Oct 2017 18:15:04 -0700 (PDT) Received: from os42.localdomain (ip68-4-115-207.oc.oc.cox.net. [68.4.115.207]) by smtp.gmail.com with ESMTPSA id 74sm24267387pft.184.2017.10.28.18.15.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 28 Oct 2017 18:15:03 -0700 (PDT) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , James Smart Subject: [PATCH 1/5] nvmet: call transport on subsystem add and delete Date: Sat, 28 Oct 2017 18:14:52 -0700 Message-Id: <20171029011456.12885-2-jsmart2021@gmail.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20171029011456.12885-1-jsmart2021@gmail.com> References: <20171029011456.12885-1-jsmart2021@gmail.com> 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 A transport may have a transport-specific mechanism that can signal when discovery controller content has changed and request a host to reconnect to the discovery controller. FC is such a transport. RSCNs may be generated by the FC port with the discovery server, with the RSCNs then broadcast to the FC-NVME hosts. A host, upon receiving the RSCN, would validate connectivity then initiate a discovery controller rescan, allowing new subsystems to be connected to or updating subsystem connectivity tables. Modify the subsystem link/unlink routines to always call a new nvmet_port_subsystem_chg() routine whenever a new subsystem is linked to a port or removed from a port. The nvmet_port_subsystem_chg() routine will look to see if the transport supports a discovery change callback, and if so, calls the callback. Signed-off-by: James Smart --- drivers/nvme/target/configfs.c | 2 ++ drivers/nvme/target/core.c | 10 ++++++++++ drivers/nvme/target/nvmet.h | 2 ++ 3 files changed, 14 insertions(+) diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c index b6aeb1d70951..38adcd7eafb1 100644 --- a/drivers/nvme/target/configfs.c +++ b/drivers/nvme/target/configfs.c @@ -503,6 +503,7 @@ static int nvmet_port_subsys_allow_link(struct config_item *parent, list_add_tail(&link->entry, &port->subsystems); nvmet_genctr++; up_write(&nvmet_config_sem); + nvmet_port_subsystem_chg(port); return 0; out_free_link: @@ -529,6 +530,7 @@ static void nvmet_port_subsys_drop_link(struct config_item *parent, found: list_del(&p->entry); nvmet_genctr++; + nvmet_port_subsystem_chg(port); if (list_empty(&port->subsystems)) nvmet_disable_port(port); up_write(&nvmet_config_sem); diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index da088293eafc..f70d900774d0 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c @@ -206,6 +206,16 @@ void nvmet_disable_port(struct nvmet_port *port) module_put(ops->owner); } +void nvmet_port_subsystem_chg(struct nvmet_port *port) +{ + struct nvmet_fabrics_ops *ops; + + ops = nvmet_transports[port->disc_addr.trtype]; + + if (ops->discov_chg) + ops->discov_chg(port); +} + static void nvmet_keep_alive_timer(struct work_struct *work) { struct nvmet_ctrl *ctrl = container_of(to_delayed_work(work), diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h index e342f02845c1..87c7f6e84694 100644 --- a/drivers/nvme/target/nvmet.h +++ b/drivers/nvme/target/nvmet.h @@ -209,6 +209,7 @@ struct nvmet_fabrics_ops { int (*add_port)(struct nvmet_port *port); void (*remove_port)(struct nvmet_port *port); void (*delete_ctrl)(struct nvmet_ctrl *ctrl); + void (*discov_chg)(struct nvmet_port *port); }; #define NVMET_MAX_INLINE_BIOVEC 8 @@ -302,6 +303,7 @@ void nvmet_unregister_transport(struct nvmet_fabrics_ops *ops); int nvmet_enable_port(struct nvmet_port *port); void nvmet_disable_port(struct nvmet_port *port); +void nvmet_port_subsystem_chg(struct nvmet_port *port); void nvmet_referral_enable(struct nvmet_port *parent, struct nvmet_port *port); void nvmet_referral_disable(struct nvmet_port *port);