[PATCH] nvme: fix warning in nvme_update_zone_info()

Chaitanya Kulkarni chaitanya.kulkarni at wdc.com
Wed Mar 3 22:47:17 GMT 2021


This fixes the issue related to the chunk size sector settings that
indirectly affects the zone append max sectors settings.

Move setting up the max zone append sectors into nvme_revalidate_zones()
that removes the following warning:-

[  256.958075] nvme nvme0: pci function 0000:00:04.0
[  256.991839] nvme nvme0: 64/0/0 default/read/poll queues
[  256.995731] ------------[ cut here ]------------
[  256.995733] WARNING: CPU: 49 PID: 362 at block/blk-settings.c:252 blk_queue_max_zone_append_sectors+0x39/0x40
[  256.995739] Modules linked in: nvme(OE) nvme_core(OE) xt_CHECKSUM xt_MASQUERADE tun bridge stp llc ip6t_rpfilter ipt_REJECT nf_reject_ipv4 ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute ip6table_nat ip6table_mangle ip6table_security ip6table_raw iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_mangle iptable_security iptable_raw ebtable_filter ebtables rfkill ip6table_filter ip6_tables iptable_filter intel_rapl_msr intel_rapl_common kvm_amd ccp kvm btrfs irqbypass bochs_drm crct10dif_pclmul drm_vram_helper ppdev crc32_pclmul blake2b_generic ghash_clmulni_intel drm_ttm_helper xor ttm aesni_intel drm_kms_helper crypto_simd cryptd syscopyarea sysfillrect sysimgblt fb_sys_fops drm i2c_piix4 nfsd raid6_pq parport_pc joydev i2c_core pcspkr parport sg auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c sd_mod ata_generic pata_acpi virtio_net net_failover failover ata_piix virtio_pci virtio_ring crc32c_intel libata t10_pi
[  256.995788]  virtio serio_raw floppy dm_mirror dm_region_hash dm_log dm_mod [last unloaded: nvme_core]
[  256.995793] CPU: 49 PID: 362 Comm: kworker/u128:32 Tainted: G        W  OE     5.11.0nvme+ #20
[  256.995796] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-44-g88ab0c15525c-prebuilt.qemu.org 04/01/2014
[  256.995797] Workqueue: nvme-wq nvme_scan_work [nvme_core]
[  256.995823] RIP: 0010:blk_queue_max_zone_append_sectors+0x39/0x40
[  256.995826] Code: fa 01 76 03 0f 0b c3 8b 87 28 04 00 00 39 87 20 04 00 00 0f 46 87 20 04 00 00 39 f0 0f 47 c6 85 c0 74 07 89 87 58 04 00 00 c3 <0f> 0b eb f5 0f 1f 00 0f 1f 44 00 00 66 89 b7 6c 04 00 00 c3 0f 1f
[  256.995827] RSP: 0018:ffffb53f40e53c00 EFLAGS: 00010246
[  256.995832] RAX: 0000000000000000 RBX: ffff909fcc756780 RCX: 0000000000000000
[  256.995834] RDX: 0000000000000001 RSI: 0000000000000400 RDI: ffff909fc43c07e8
[  256.995835] RBP: ffff90a007413000 R08: ffff90a6dfa6ba58 R09: 0000003bd567254e
[  256.995836] R10: 0000000000000000 R11: ffffffffffffffff R12: ffffb53f40e53c08
[  256.995836] R13: 0000000000000b00 R14: ffff909fc43c07e8 R15: 0000000000000000
[  256.995838] FS:  0000000000000000(0000) GS:ffff90a6dfa40000(0000) knlGS:0000000000000000
[  256.995840] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  256.995841] CR2: 00007fc9005345b0 CR3: 00000001041c8000 CR4: 00000000003506e0
[  256.995843] Call Trace:
[  256.995845]  nvme_update_zone_info+0x1b7/0x200 [nvme_core]
[  256.995851]  nvme_update_ns_info+0x55a/0x5c0 [nvme_core]
[  256.995856]  ? pm_runtime_init+0x85/0xb0
[  256.995859]  nvme_alloc_ns+0x2a0/0x7d0 [nvme_core]
[  256.995865]  ? __cond_resched+0x15/0x30
[  256.995868]  nvme_validate_or_alloc_ns+0xa1/0x180 [nvme_core]
[  256.995873]  nvme_scan_work+0x13e/0x270 [nvme_core]
[  256.995881]  process_one_work+0x1aa/0x340
[  256.995885]  worker_thread+0x30/0x390
[  256.995886]  ? rescuer_thread+0x350/0x350
[  256.995887]  kthread+0x116/0x130
[  256.995889]  ? __kthread_parkme+0x70/0x70
[  256.995890]  ret_from_fork+0x22/0x30
[  256.995894] ---[ end trace 34558f0693930871 ]---

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 drivers/nvme/host/zns.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c
index c7e3ec561ba0..bc2f344f0ae0 100644
--- a/drivers/nvme/host/zns.c
+++ b/drivers/nvme/host/zns.c
@@ -9,7 +9,13 @@
 
 int nvme_revalidate_zones(struct nvme_ns *ns)
 {
-	return blk_revalidate_disk_zones(ns->disk, NULL);
+	struct request_queue *q = ns->queue;
+	int ret;
+
+	ret = blk_revalidate_disk_zones(ns->disk, NULL);
+	if (!ret)
+		blk_queue_max_zone_append_sectors(q, ns->ctrl->max_zone_append);
+	return ret;
 }
 
 static int nvme_set_max_append(struct nvme_ctrl *ctrl)
@@ -107,7 +113,6 @@ int nvme_update_zone_info(struct nvme_ns *ns, unsigned lbaf)
 	blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
 	blk_queue_max_open_zones(q, le32_to_cpu(id->mor) + 1);
 	blk_queue_max_active_zones(q, le32_to_cpu(id->mar) + 1);
-	blk_queue_max_zone_append_sectors(q, ns->ctrl->max_zone_append);
 free_data:
 	kfree(id);
 	return status;
-- 
2.22.1






More information about the Linux-nvme mailing list