From: sashiko-bot@kernel.org
To: "Guixin Liu" <kanie@linux.alibaba.com>
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH 03/11] nvme: export nvme_bdev_ops
Date: Fri, 23 Oct 2026 08:14:32 +0000 [thread overview]
Message-ID: <sashiko-outbox-182494@kernel.org> (raw)
In-Reply-To: <20261023080251.2606443-4-kanie@linux.alibaba.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] nvme: exporting only nvme_bdev_ops misses multipathed NVMe namespaces
--
commit 764e628e097c80c3a597aca0fdc4893155c2715b
Author: Guixin Liu <kanie@linux.alibaba.com>
nvme: export nvme_bdev_ops
This commit exports nvme_bdev_ops so that external subsystems such as the
NVMe target FDP bridge can identify an NVMe namespace block device by its
block_device_operations pointer and access its underlying NVMe structures.
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 7eb0f9fe6b18d..0099ce5730b20 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2719,6 +2719,7 @@ const struct block_device_operations nvme_bdev_ops = {
> .report_zones = nvme_report_zones,
> .pr_ops = &nvme_pr_ops,
> };
> +EXPORT_SYMBOL_GPL(nvme_bdev_ops);
[Severity: Medium]
Does exporting only nvme_bdev_ops work when NVMe multipathing is active for
the backing namespace?
When multipathing is enabled for a namespace, nvme_mpath_alloc_disk() in
drivers/nvme/host/multipath.c sets up the user-visible /dev/nvmeXnY gendisk
with nvme_ns_head_ops and stores struct nvme_ns_head * in private_data:
head->disk->fops = &nvme_ns_head_ops;
head->disk->private_data = head;
Meanwhile, nvme_alloc_ns() in drivers/nvme/host/core.c marks the
per-controller disk (which uses nvme_bdev_ops and stores struct nvme_ns * in
disk->private_data) as hidden so it cannot be opened as a backing block
device:
if (nvme_ns_head_multipath(ns->head)) {
sprintf(disk->disk_name, "nvme%dc%dn%d", ctrl->subsys->instance,
ctrl->instance, ns->head->instance);
disk->flags |= GENHD_FL_HIDDEN;
}
When the NVMe target FDP bridge in nvmet_fdp_init_ns() checks
bdev->bd_disk->fops != &nvme_bdev_ops on an opened /dev/nvmeXnY device,
won't it reject valid multipathed NVMe namespaces with -EINVAL because
bdev->bd_disk->fops is &nvme_ns_head_ops?
Instead of exporting nvme_bdev_ops and having callers inspect
bdev->bd_disk->fops and bdev->bd_disk->private_data directly, would it make
sense to provide a helper in drivers/nvme/host/core.c (similar to
nvme_ctrl_from_file()) that handles both nvme_bdev_ops and nvme_ns_head_ops?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261023080251.2606443-1-kanie@linux.alibaba.com?part=3
next prev parent reply other threads:[~2026-10-23 8:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 8:02 [PATCH v2 0/11] nvmet: FDP bridge for NVMe-oF targets Guixin Liu
2026-10-23 8:02 ` [PATCH 01/11] nvme: add the FDP wire structures for the I/O management send command Guixin Liu
2026-10-23 8:02 ` [PATCH 02/11] block: add bdev_write_stream_granularity() Guixin Liu
2026-10-23 8:02 ` [PATCH 03/11] nvme: export nvme_bdev_ops Guixin Liu
2026-10-23 8:14 ` sashiko-bot [this message]
2026-10-23 8:02 ` [PATCH 04/11] nvmet: add per-namespace FDP bridge state and configuration Guixin Liu
2026-10-23 8:02 ` [PATCH 05/11] nvmet: report the Endurance Group Identifier in the CS-INDEP identify data Guixin Liu
2026-10-23 8:02 ` [PATCH 06/11] nvmet: advertise the FDP capability Guixin Liu
2026-10-23 8:02 ` [PATCH 07/11] nvmet: implement the FDP feature Guixin Liu
2026-10-23 8:26 ` sashiko-bot
2026-10-23 8:02 ` [PATCH 08/11] nvmet: forward the FDP I/O management commands to the backing device Guixin Liu
2026-10-23 8:37 ` sashiko-bot
2026-10-23 8:02 ` [PATCH 09/11] nvmet: serve the FDP log pages Guixin Liu
2026-10-23 8:37 ` sashiko-bot
2026-10-23 8:02 ` [PATCH 10/11] nvmet: translate placement identifiers of writes to write streams Guixin Liu
2026-10-23 8:02 ` [PATCH 11/11] nvmet: add an FDP write translation tracepoint Guixin Liu
-- strict thread matches above, loose matches on Subject: below --
2026-10-19 3:36 [PATCH RESEND 0/11] nvmet: FDP bridge for NVMe-oF targets Guixin Liu
2026-10-19 3:36 ` [PATCH 03/11] nvme: export nvme_bdev_ops Guixin Liu
2026-10-13 2:20 [PATCH 0/11] nvmet: FDP bridge for NVMe-oF targets Guixin Liu
2026-10-13 2:21 ` [PATCH 03/11] nvme: export nvme_bdev_ops Guixin Liu
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=sashiko-outbox-182494@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kanie@linux.alibaba.com \
--cc=linux-nvme@lists.infradead.org \
--cc=sashiko-reviews@lists.linux.dev \
/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