* [PATCH] nvme-multipath: revalidate head zones after unfreezing the head queue
@ 2026-09-30 6:26 Palla Raghunath
2026-09-30 7:45 ` Damien Le Moal
2026-09-30 9:36 ` Yao Sang
0 siblings, 2 replies; 3+ messages in thread
From: Palla Raghunath @ 2026-09-30 6:26 UTC (permalink / raw)
To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
Damien Le Moal, Yao Sang
Cc: Shuah Khan, Brigham Campbell, linux-kernel-mentees,
raghunathpalla.0209, linux-kernel, syzbot+b0910be96b7c31314822,
syzbot+2e02ccadb3c5522a5c59, linux-nvme
When a namespace on a multipath controller is updated,
nvme_update_ns_info() freezes the head disk queue, commits the new
limits, and then calls nvme_mpath_revalidate_zones() before it
unfreezes the queue again.
That is the wrong way round for blk_revalidate_disk_zones(). It starts
a limits update, which takes q->limits_lock, and it freezes the queue
itself while updating the zone resources. The block layer takes
limits_lock before freezing the queue, never the other way around, so
calling it with the head queue already frozen reverses that order.
syzbot has hit this twice. One report goes through q->limits_lock. The
other one is on linux-next, where blk_revalidate_disk_zones() also
takes disk->zone_revalidate_mutex and holds it across alloc_workqueue()
the first time a disk's zone resources are set up. Lockdep then sees:
q_usage_counter(io) (frozen head queue, nvme_update_ns_info())
--> &disk->zone_revalidate_mutex
--> wq_pool_mutex --> fs_reclaim --> q_usage_counter(io)
WARNING: possible circular locking dependency detected
kworker/u8:10/3352 is trying to acquire lock:
(&disk->zone_revalidate_mutex){+.+.}-{4:4}, at: blk_revalidate_disk_zones+0x1c5/0x1650
but task is already holding lock:
(&q->q_usage_counter(io)#75){++++}-{0:0}, at: nvme_update_ns_info+0x3ac/0x1200
...
blk_revalidate_disk_zones+0x1c5/0x1650 block/blk-zoned.c:2560
nvme_mpath_revalidate_zones+0x106/0x1c0 drivers/nvme/host/multipath.c:301
nvme_update_ns_info+0x984/0x1200 drivers/nvme/host/core.c:2620
The rest of the driver already does this correctly:
nvme_update_ns_info_block() unfreezes ns->disk->queue before calling
blk_revalidate_disk_zones(), and nvme_mpath_set_live() revalidates the
head zones without freezing the queue. Do the same here, and only
revalidate the head zones once the queue is unfrozen and the limits
update has succeeded.
Fixes: 224041412693 ("nvme-multipath: revalidate zones for namespace heads")
Reported-by: syzbot+b0910be96b7c31314822@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=b0910be96b7c31314822
Reported-by: syzbot+2e02ccadb3c5522a5c59@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=2e02ccadb3c5522a5c59
Link: https://lore.kernel.org/all/2bfc96f2-7d0d-47e0-936e-8810abb31a9f@acm.org/
Cc: Shuah Khan <shuah@kernel.org>
Cc: Brigham Campbell <me@brighamcampbell.com>
Signed-off-by: Palla Raghunath <raghunathpalla.0209@gmail.com>
---
drivers/nvme/host/core.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ee7d09030c18..5d7dfd7a63d4 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2617,10 +2617,19 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_ns_info *info)
set_capacity_and_notify(ns->head->disk, get_capacity(ns->disk));
set_disk_ro(ns->head->disk, nvme_ns_is_readonly(ns, info));
nvme_mpath_revalidate_paths(ns->head);
- ret = nvme_mpath_revalidate_zones(ns->head);
unfreeze_head_queue:
blk_mq_unfreeze_queue(ns->head->disk->queue, memflags);
+
+ /*
+ * Wait until the head queue is unfrozen before revalidating
+ * its zones. blk_revalidate_disk_zones() takes the queue limits
+ * lock and then freezes the queue on its own, so it must not be
+ * called with the queue already frozen. This is also what
+ * nvme_update_ns_info_block() does for ns->disk.
+ */
+ if (!ret)
+ ret = nvme_mpath_revalidate_zones(ns->head);
}
return ret;
base-commit: 4a5e49ba0abb8b4328d6318c9aef0c0121f95507
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-multipath: revalidate head zones after unfreezing the head queue
2026-09-30 6:26 [PATCH] nvme-multipath: revalidate head zones after unfreezing the head queue Palla Raghunath
@ 2026-09-30 7:45 ` Damien Le Moal
2026-09-30 9:36 ` Yao Sang
1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2026-09-30 7:45 UTC (permalink / raw)
To: Palla Raghunath, Keith Busch, Jens Axboe, Christoph Hellwig,
Sagi Grimberg, Yao Sang
Cc: Shuah Khan, Brigham Campbell, linux-kernel-mentees, linux-kernel,
syzbot+b0910be96b7c31314822, syzbot+2e02ccadb3c5522a5c59,
linux-nvme
On 2026/09/30 8:26, Palla Raghunath wrote:
> When a namespace on a multipath controller is updated,
> nvme_update_ns_info() freezes the head disk queue, commits the new
> limits, and then calls nvme_mpath_revalidate_zones() before it
> unfreezes the queue again.
>
> That is the wrong way round for blk_revalidate_disk_zones(). It starts
> a limits update, which takes q->limits_lock, and it freezes the queue
> itself while updating the zone resources. The block layer takes
> limits_lock before freezing the queue, never the other way around, so
> calling it with the head queue already frozen reverses that order.
>
> syzbot has hit this twice. One report goes through q->limits_lock. The
> other one is on linux-next, where blk_revalidate_disk_zones() also
> takes disk->zone_revalidate_mutex and holds it across alloc_workqueue()
> the first time a disk's zone resources are set up. Lockdep then sees:
>
> q_usage_counter(io) (frozen head queue, nvme_update_ns_info())
> --> &disk->zone_revalidate_mutex
> --> wq_pool_mutex --> fs_reclaim --> q_usage_counter(io)
>
> WARNING: possible circular locking dependency detected
> kworker/u8:10/3352 is trying to acquire lock:
> (&disk->zone_revalidate_mutex){+.+.}-{4:4}, at: blk_revalidate_disk_zones+0x1c5/0x1650
> but task is already holding lock:
> (&q->q_usage_counter(io)#75){++++}-{0:0}, at: nvme_update_ns_info+0x3ac/0x1200
> ...
> blk_revalidate_disk_zones+0x1c5/0x1650 block/blk-zoned.c:2560
> nvme_mpath_revalidate_zones+0x106/0x1c0 drivers/nvme/host/multipath.c:301
> nvme_update_ns_info+0x984/0x1200 drivers/nvme/host/core.c:2620
>
> The rest of the driver already does this correctly:
> nvme_update_ns_info_block() unfreezes ns->disk->queue before calling
> blk_revalidate_disk_zones(), and nvme_mpath_set_live() revalidates the
> head zones without freezing the queue. Do the same here, and only
> revalidate the head zones once the queue is unfrozen and the limits
> update has succeeded.
>
> Fixes: 224041412693 ("nvme-multipath: revalidate zones for namespace heads")
> Reported-by: syzbot+b0910be96b7c31314822@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=b0910be96b7c31314822
> Reported-by: syzbot+2e02ccadb3c5522a5c59@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=2e02ccadb3c5522a5c59
> Link: https://lore.kernel.org/all/2bfc96f2-7d0d-47e0-936e-8810abb31a9f@acm.org/
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: Brigham Campbell <me@brighamcampbell.com>
> Signed-off-by: Palla Raghunath <raghunathpalla.0209@gmail.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-multipath: revalidate head zones after unfreezing the head queue
2026-09-30 6:26 [PATCH] nvme-multipath: revalidate head zones after unfreezing the head queue Palla Raghunath
2026-09-30 7:45 ` Damien Le Moal
@ 2026-09-30 9:36 ` Yao Sang
1 sibling, 0 replies; 3+ messages in thread
From: Yao Sang @ 2026-09-30 9:36 UTC (permalink / raw)
To: raghunathpalla.0209
Cc: axboe, dlemoal, hch, kbusch, linux-kernel-mentees, linux-kernel,
linux-nvme, me, sagi, sangyao, shuah,
syzbot+2e02ccadb3c5522a5c59, syzbot+b0910be96b7c31314822
Looks good to me:
Reviewed-by: Yao Sang <sangyao@kylinos.cn>
Tested-by: Yao Sang <sangyao@kylinos.cn>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-30 9:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-30 6:26 [PATCH] nvme-multipath: revalidate head zones after unfreezing the head queue Palla Raghunath
2026-09-30 7:45 ` Damien Le Moal
2026-09-30 9:36 ` Yao Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®