From: javier@javigon.com To: linux-nvme@lists.infradead.org Cc: linux-block@vger.kernel.org, hch@lst.de, kbusch@kernel.org, sagi@grimberg.me, minwoo.im.dev@gmail.com Subject: [PATCH V6 2/2] nvme: allow open for nvme-generic char device Date: Mon, 1 Mar 2021 20:24:52 +0100 [thread overview] Message-ID: <20210301192452.16770-3-javier.gonz@samsung.com> (raw) In-Reply-To: <20210301192452.16770-1-javier.gonz@samsung.com> From: Minwoo Im <minwoo.im.dev@gmail.com> Keep rejecting the hidden device access via open, but allow cases through the nvme-generic char device by moving check for head namespace to nvme_open() from nvme_ns_open(). Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com> --- drivers/nvme/host/core.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index b94609bc92f4..ed66ff33a85a 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1887,11 +1887,6 @@ static int nvme_compat_ioctl(struct block_device *bdev, fmode_t mode, static int nvme_ns_open(struct nvme_ns *ns) { -#ifdef CONFIG_NVME_MULTIPATH - /* should never be called due to GENHD_FL_HIDDEN */ - if (WARN_ON_ONCE(ns->head->disk)) - goto fail; -#endif if (!kref_get_unless_zero(&ns->kref)) goto fail; if (!try_module_get(ns->ctrl->ops->module)) @@ -1913,7 +1908,15 @@ static void nvme_ns_release(struct nvme_ns *ns) static int nvme_open(struct block_device *bdev, fmode_t mode) { - return nvme_ns_open(bdev->bd_disk->private_data); + struct nvme_ns *ns = bdev->bd_disk->private_data; + +#ifdef CONFIG_NVME_MULTIPATH + /* should never be called due to GENHD_FL_HIDDEN */ + if (WARN_ON_ONCE(ns->head->disk)) + return -ENXIO; +#endif + + return nvme_ns_open(ns); } static void nvme_release(struct gendisk *disk, fmode_t mode) -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: javier@javigon.com To: linux-nvme@lists.infradead.org Cc: linux-block@vger.kernel.org, kbusch@kernel.org, minwoo.im.dev@gmail.com, hch@lst.de, sagi@grimberg.me Subject: [PATCH V6 2/2] nvme: allow open for nvme-generic char device Date: Mon, 1 Mar 2021 20:24:52 +0100 [thread overview] Message-ID: <20210301192452.16770-3-javier.gonz@samsung.com> (raw) In-Reply-To: <20210301192452.16770-1-javier.gonz@samsung.com> From: Minwoo Im <minwoo.im.dev@gmail.com> Keep rejecting the hidden device access via open, but allow cases through the nvme-generic char device by moving check for head namespace to nvme_open() from nvme_ns_open(). Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com> --- drivers/nvme/host/core.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index b94609bc92f4..ed66ff33a85a 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1887,11 +1887,6 @@ static int nvme_compat_ioctl(struct block_device *bdev, fmode_t mode, static int nvme_ns_open(struct nvme_ns *ns) { -#ifdef CONFIG_NVME_MULTIPATH - /* should never be called due to GENHD_FL_HIDDEN */ - if (WARN_ON_ONCE(ns->head->disk)) - goto fail; -#endif if (!kref_get_unless_zero(&ns->kref)) goto fail; if (!try_module_get(ns->ctrl->ops->module)) @@ -1913,7 +1908,15 @@ static void nvme_ns_release(struct nvme_ns *ns) static int nvme_open(struct block_device *bdev, fmode_t mode) { - return nvme_ns_open(bdev->bd_disk->private_data); + struct nvme_ns *ns = bdev->bd_disk->private_data; + +#ifdef CONFIG_NVME_MULTIPATH + /* should never be called due to GENHD_FL_HIDDEN */ + if (WARN_ON_ONCE(ns->head->disk)) + return -ENXIO; +#endif + + return nvme_ns_open(ns); } static void nvme_release(struct gendisk *disk, fmode_t mode) -- 2.17.1 _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2021-03-01 19:30 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-01 19:24 [PATCH V6 0/2] nvme: enable char device per namespace javier 2021-03-01 19:24 ` javier 2021-03-01 19:24 ` [PATCH V6 1/2] " javier 2021-03-01 19:24 ` javier 2021-03-03 9:10 ` Christoph Hellwig 2021-03-03 9:10 ` Christoph Hellwig 2021-03-03 10:02 ` Javier González 2021-03-03 10:02 ` Javier González 2021-03-09 11:31 ` Christoph Hellwig 2021-03-09 11:31 ` Christoph Hellwig 2021-03-09 12:42 ` Javier González 2021-03-09 12:42 ` Javier González 2021-03-09 15:05 ` Christoph Hellwig 2021-03-09 15:05 ` Christoph Hellwig 2021-03-09 21:18 ` Javier González 2021-03-09 21:18 ` Javier González 2021-03-24 12:29 ` Niklas Cassel 2021-03-24 12:29 ` Niklas Cassel 2021-03-25 2:09 ` Minwoo Im 2021-03-25 2:09 ` Minwoo Im 2021-03-25 8:26 ` hch 2021-03-25 8:26 ` hch 2021-03-25 8:39 ` Niklas Cassel 2021-03-25 8:39 ` Niklas Cassel 2021-03-25 9:34 ` Minwoo Im 2021-03-25 9:34 ` Minwoo Im 2021-03-25 12:25 ` Niklas Cassel 2021-03-25 12:25 ` Niklas Cassel 2021-03-25 12:33 ` Minwoo Im 2021-03-25 12:33 ` Minwoo Im 2021-03-25 15:14 ` Keith Busch 2021-03-25 15:14 ` Keith Busch 2021-03-01 19:24 ` javier [this message] 2021-03-01 19:24 ` [PATCH V6 2/2] nvme: allow open for nvme-generic char device javier
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=20210301192452.16770-3-javier.gonz@samsung.com \ --to=javier@javigon.com \ --cc=hch@lst.de \ --cc=kbusch@kernel.org \ --cc=linux-block@vger.kernel.org \ --cc=linux-nvme@lists.infradead.org \ --cc=minwoo.im.dev@gmail.com \ --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: linkBe 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.