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 <kbusch@kernel.org>,
linux-nvme@lists.infradead.org
Subject: Re: [PATCH 1/3] nvmet: make the subsystem type configurable
Date: Thu, 7 Apr 2022 17:44:17 +0200 [thread overview]
Message-ID: <20220407154417.GC15988@lst.de> (raw)
In-Reply-To: <20220407104808.29007-2-hare@suse.de>
On Thu, Apr 07, 2022 at 12:48:06PM +0200, Hannes Reinecke wrote:
> +static ssize_t nvmet_subsys_attr_type_store(struct config_item *item,
> + const char *page, size_t count)
> +{
> + struct nvmet_subsys *subsys = to_subsys(item);
> + struct nvmet_port *p;
> + struct nvmet_subsys_link *s;
> + int i;
> +
> + if (subsys->subsys_discovered)
> + return -EACCES;
> +
> + /*
> + * Do not allow to change the subsystem type if it's
> + * already linked to ports; the user should unlink it first.
> + */
> + down_read(&nvmet_config_sem);
> + list_for_each_entry(p, &nvmet_ports_list, global_entry) {
> + list_for_each_entry(s, &p->subsystems, entry) {
> + if (s->subsys == subsys) {
> + up_read(&nvmet_config_sem);
> + return -EACCES;
> + }
> + }
> + }
> + up_read(&nvmet_config_sem);
Does this scale? Do we want a flag in the subsystem instead?
> + for (i = 0; i < ARRAY_SIZE(nvmet_subsys_type_map); i++) {
> + if (sysfs_streq(page, nvmet_subsys_type_map[i].name))
> + goto found;
> + }
> +
> + pr_err("Invalid value '%s' for subsystem type\n", page);
> + return -EINVAL;
> +
> +found:
> + down_write(&nvmet_config_sem);
> + if (nvmet_subsys_type_map[i].type == NVME_NQN_CURR) {
> + if (!xa_empty(&subsys->namespaces)) {
> + pr_err("discovery subsystem cannot have namespaces\n");
> + return -EINVAL;
> + }
> + }
We can probably just check this unconditionally, as something that was
a discovery subsystem before by definition can't have namespaces.
next prev parent reply other threads:[~2022-04-07 16:06 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 10:48 [PATCHv4 0/3] nvmet: unique discovery subsystems Hannes Reinecke
2022-04-07 10:48 ` [PATCH 1/3] nvmet: make the subsystem type configurable Hannes Reinecke
2022-04-07 15:44 ` Christoph Hellwig [this message]
2022-04-07 16:55 ` Hannes Reinecke
2022-04-08 5:46 ` Christoph Hellwig
2022-04-07 10:48 ` [PATCH 2/3] nvmet: per-port discovery subsystem Hannes Reinecke
2022-04-07 15:49 ` Christoph Hellwig
2022-04-07 17:21 ` Hannes Reinecke
2022-04-08 5:48 ` Christoph Hellwig
2022-04-07 10:48 ` [PATCH 3/3] nvmet: include all configured ports in the discovery log page Hannes Reinecke
2022-04-07 13:29 ` Sagi Grimberg
2022-04-07 13:31 ` Hannes Reinecke
2022-04-07 13:34 ` Christoph Hellwig
2022-04-07 13:38 ` Sagi Grimberg
2022-04-07 14:51 ` Hannes Reinecke
2022-04-07 15:38 ` Christoph Hellwig
2022-04-07 15:41 ` Christoph Hellwig
2022-04-07 17:25 ` Hannes Reinecke
-- strict thread matches above, loose matches on Subject: below --
2022-04-08 6:59 [PATCHv5 0/3] nvmet: unique discovery subsystems Hannes Reinecke
2022-04-08 6:59 ` [PATCH 1/3] nvmet: make the subsystem type configurable Hannes Reinecke
2022-04-11 10:32 ` Sagi Grimberg
2022-04-11 10:52 ` Hannes Reinecke
2022-04-11 10:36 ` Sagi Grimberg
2022-04-06 14:22 [PATCHv3 0/3] nvmet: unique discovery subsystem Hannes Reinecke
2022-04-06 14:22 ` [PATCH 1/3] nvmet: make the subsystem type configurable 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=20220407154417.GC15988@lst.de \
--to=hch@lst.de \
--cc=hare@suse.de \
--cc=kbusch@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.