On 21-02-05 08:22:52, Keith Busch wrote:
> On Sat, Feb 06, 2021 at 01:07:57AM +0900, Minwoo Im wrote:
> > If multipath is enabled, the namespace head and hidden namespace will be
> > created. In this case, /sys/block/nvme0n1/queue/nr_zones are not
> > returning proper value for the namespace itself. By the way, the hidden
> > namespace /sys/block/nvme0c0n1/queue/nr_zones are returning properly.
> >
> > Is it okay for sysfs of the head namespace node (nvme0n1) not to manage
> > the request queue attributes like nr_zones?
>
> This should fix it. Untested, as my dev machine is in need of repair,
> but if someone can confirm this is successful, I can send it to the
> kernel list.
>
> ---
> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
> index 65bd6efa5e1c..eb18949bb999 100644
> --- a/drivers/nvme/host/multipath.c
> +++ b/drivers/nvme/host/multipath.c
> @@ -677,6 +677,8 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct
> nvme_id_ns *id)
> if (blk_queue_stable_writes(ns->queue) && ns->head->disk)
> blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES,
> ns->head->disk->queue);
> + if (blk_queue_is_zoned(ns->queue))
> + blk_revalidate_disk_zones(ns->head->disk, NULL);
> }
>
> void nvme_mpath_remove_disk(struct nvme_ns_head *head)
> --
Thanks Keith,
Just for sharing testing result based on this kernel quickly:
In blk_revalidate_disk_zones(),
488 int blk_revalidate_disk_zones(struct gendisk *disk,
489 void (*update_driver_data)(struct
gendisk *disk))
490 {
491 struct request_queue *q = disk->queue;
492 struct blk_revalidate_zone_args args = {
493 .disk = disk,
494 };
495 unsigned int noio_flag;
496 int ret;
497
498 if (WARN_ON_ONCE(!blk_queue_is_zoned(q)))
499 return -EIO;
500 if (WARN_ON_ONCE(!queue_is_mq(q)))
501 return -EIO;
^^^^^^^^^^^^
(q->mq_ops == NULL) in this case, so that the q->nr_zones are not
getting set.