From: Christoph Hellwig <hch@lst.de>
To: Hannes Reinecke <hare@suse.de>
Cc: Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
Keith Busch <keith.busch@wdc.com>,
linux-nvme@lists.infradead.org
Subject: Re: [PATCH 1/3] nvmet: check for subsystem type in nvmet_find_get_subsys()
Date: Tue, 5 Apr 2022 07:45:36 +0200 [thread overview]
Message-ID: <20220405054536.GB23466@lst.de> (raw)
In-Reply-To: <20220317142634.49324-2-hare@suse.de>
On Thu, Mar 17, 2022 at 03:26:32PM +0100, Hannes Reinecke wrote:
> When looking for a subsystem we have two ways of finding the
> subsystem: either looking for the subsystem NQN itself, or check
> the type of the subsystem when looking for a discovery controller.
> This patch implements this check, and also moves the check for
> the static discovery controller to the end such that we can
> return unique discovery controllers.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
> drivers/nvme/target/core.c | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> index b0dc6230d1b9..83eba511d098 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -1508,12 +1508,6 @@ static struct nvmet_subsys *nvmet_find_get_subsys(struct nvmet_port *port,
> if (!port)
> return NULL;
>
> - if (!strcmp(NVME_DISC_SUBSYS_NAME, subsysnqn)) {
> - if (!kref_get_unless_zero(&nvmet_disc_subsys->ref))
> - return NULL;
> - return nvmet_disc_subsys;
> - }
> -
> down_read(&nvmet_config_sem);
> list_for_each_entry(p, &port->subsystems, entry) {
> if (!strncmp(p->subsys->subsysnqn, subsysnqn,
> @@ -1523,8 +1517,22 @@ static struct nvmet_subsys *nvmet_find_get_subsys(struct nvmet_port *port,
> up_read(&nvmet_config_sem);
> return p->subsys;
> }
> + if (!strcmp(NVME_DISC_SUBSYS_NAME, subsysnqn) &&
> + nvmet_is_disc_subsys(p->subsys)) {
I don't get this. The strcmp is on the passed in subqnen that we are
looking for. So with this patch we now do the fairly expensive string
compare for every subsystem in the loop, and the just retuns the first
discovery subsystems when we look for the well known discovery
subsystem. As-is there is only one, so this is pointless. If we add
discovery subsystems with different names (as I assume the later patches
do), this changes beahvior in a rather unexpected way.
next prev parent reply other threads:[~2022-04-05 5:45 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-17 14:26 [PATCHv2 0/3] nvmet: unique discovery subsystem Hannes Reinecke
2022-03-17 14:26 ` [PATCH 1/3] nvmet: check for subsystem type in nvmet_find_get_subsys() Hannes Reinecke
2022-04-05 5:45 ` Christoph Hellwig [this message]
2022-04-05 5:53 ` Hannes Reinecke
2022-04-05 6:07 ` Christoph Hellwig
2022-04-05 13:06 ` John Meneghini
2022-03-17 14:26 ` [PATCH 2/3] nvmet: make the subsystem type configurable Hannes Reinecke
2022-04-05 5:47 ` Christoph Hellwig
2022-04-05 6:00 ` Hannes Reinecke
2022-04-05 6:09 ` Christoph Hellwig
2022-04-05 6:29 ` Hannes Reinecke
2022-04-05 10:35 ` Sagi Grimberg
2022-04-05 11:12 ` Hannes Reinecke
2022-04-05 15:02 ` John Meneghini
2022-04-05 13:15 ` John Meneghini
2022-03-17 14:26 ` [PATCH 3/3] nvmet: include all configured ports in discovery log page for unique discover controller Hannes Reinecke
2022-04-05 5:46 ` Christoph Hellwig
2022-04-05 6:15 ` Hannes Reinecke
2022-04-05 6:19 ` Christoph Hellwig
2022-04-05 6:35 ` Hannes Reinecke
2022-04-05 7:31 ` Christoph Hellwig
2022-04-05 10:32 ` Sagi Grimberg
2022-04-05 15:09 ` John Meneghini
2022-04-06 11:39 ` Hannes Reinecke
2022-04-05 10:41 ` Sagi Grimberg
2022-04-05 11:01 ` Hannes Reinecke
2022-04-05 14:22 ` Sagi Grimberg
-- strict thread matches above, loose matches on Subject: below --
2022-03-17 13:18 [PATCH 0/3] nvmet: unique discovery subsystem Hannes Reinecke
2022-03-17 13:18 ` [PATCH 1/3] nvmet: check for subsystem type in nvmet_find_get_subsys() Hannes Reinecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220405054536.GB23466@lst.de \
--to=hch@lst.de \
--cc=hare@suse.de \
--cc=keith.busch@wdc.com \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox