While running file system tests (xfstest) on IBM Power following warning was seen: [ 750.845015] run fstests generic/347 at 2024-04-13 03:58:42 [ 751.017900] XFS (loop0): Mounting V5 Filesystem 998a731d-ad3f-467d-ad31-92990b381696 [ 751.019105] XFS (loop0): Ending clean mount [ 751.372715] ------------[ cut here ]------------ [ 751.372729] WARNING: CPU: 2 PID: 12 at drivers/md/dm-bio-prison-v1.c:128 dm_cell_key_has_valid_range+0x44/0x68 [dm_bio_prison] [ 751.372741] Modules linked in: dm_thin_pool dm_persistent_data dm_bio_prison dm_snapshot dm_bufio dm_flakey xfs loop dm_mod nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 bonding tls rfkill ip_set nf_tables libcrc32c nfnetlink sunrpc pseries_rng vmx_crypto fuse ext4 mbcache jbd2 sd_mod t10_pi crc64_rocksoft_generic crc64_rocksoft crc64 sg ibmvscsi scsi_transport_srp ibmveth [last unloaded: scsi_debug] [ 751.372785] CPU: 2 PID: 12 Comm: kworker/u256:1 Kdump: loaded Not tainted 6.9.0-rc3-next-20240412 #1 [ 751.372790] Hardware name: IBM,9080-HEX POWER10 (raw) 0x800200 0xf000006 of:IBM,FW1060.00 (NH1060_018) hv:phyp pSeries [ 751.372795] Workqueue: dm-thin do_worker [dm_thin_pool] [ 751.372801] NIP: c00800000ca80100 LR: c00800000cfd66e8 CTR: c00800000ca800bc [ 751.372805] REGS: c000000004bbf9b0 TRAP: 0700 Not tainted (6.9.0-rc3-next-20240412) [ 751.372810] MSR: 800000000282b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 44002482 XER: 20040000 [ 751.372820] CFAR: c00800000ca800d4 IRQMASK: 0 [ 751.372820] GPR00: c00800000cfd66e8 c000000004bbfc50 c00800000d008b00 c000000004bbfcb8 [ 751.372820] GPR04: c0000001f7afb1b8 c000000156dd4a30 0000000000000005 0000000000000400 [ 751.372820] GPR08: 0000000000001000 0000000000001000 0000000000000000 c00800000cfdf390 [ 751.372820] GPR12: c00800000ca800bc c000000effffcf00 c0000000001a063c c000000004045380 [ 751.372820] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 [ 751.372820] GPR20: c000000004082000 c000000156dd4890 0000000000000001 c00000006683d24c [ 751.372820] GPR24: c000000156dd4a40 0000000000000000 0000000000000000 c00000006683d200 [ 751.372820] GPR28: c0000001f7afb1b8 c00000006683d200 0000000000000000 0000000000001000 [ 751.372865] NIP [c00800000ca80100] dm_cell_key_has_valid_range+0x44/0x68 [dm_bio_prison] [ 751.372871] LR [c00800000cfd66e8] process_discard_bio+0xac/0x1f0 [dm_thin_pool] [ 751.372877] Call Trace: [ 751.372880] [c000000004bbfd00] [c00800000cfd89d4] process_thin_deferred_bios+0x158/0x428 [dm_thin_pool] [ 751.372887] [c000000004bbfdc0] [c00800000cfd8d00] process_deferred_bios+0x5c/0x2f4 [dm_thin_pool] [ 751.372894] [c000000004bbfe00] [c00800000cfd9098] do_worker+0x100/0x1f8 [dm_thin_pool] [ 751.372900] [c000000004bbfe40] [c00000000019326c] process_one_work+0x20c/0x4f4 [ 751.372908] [c000000004bbfef0] [c0000000001941ec] worker_thread+0x378/0x544 [ 751.372914] [c000000004bbff90] [c0000000001a076c] kthread+0x138/0x140 [ 751.372919] [c000000004bbffe0] [c00000000000df98] start_kernel_thread+0x14/0x18 [ 751.372924] Code: 28280400 4181002c 3929ffff 794ab282 38600001 7929b282 7c2a4800 40820024 786307e0 4e800020 60000000 60000000 <0fe00000> 38600000 786307e0 4e800020 [ 751.372938] ---[ end trace 0000000000000000 ]--- [ 751.372941] device-mapper: thin: Discard doesn't respect bio prison limits [ 751.373000] device-mapper: thin: Discard doesn't respect bio prison limits [ 751.373022] device-mapper: thin: Discard doesn't respect bio prison limits This WARN_ON_ONCE was introduced by commit 3f8d3f5432078a558151e27230e20bcf93c23ffe dm bio prison v1: add dm_cell_key_has_valid_range bool dm_cell_key_has_valid_range(struct dm_cell_key *key) { if (WARN_ON_ONCE(key->block_end - key->block_begin > BIO_PRISON_MAX_RANGE)) return false; — Sachin