Re: [PATCH 16/17] btrfs: split zone append bios in btrfs_submit_bio

Johannes Thumshirn
2022-09-05T14:32:03Z

On 05.09.22 16:25, Christoph Hellwig wrote:
> On Mon, Sep 05, 2022 at 01:15:16PM +0000, Johannes Thumshirn wrote:
>> On 01.09.22 09:43, Christoph Hellwig wrote:
>>> + ASSERT(btrfs_dev_is_sequential(dev, physical));
>>> + bio->bi_iter.bi_sector = zone_start >> SECTOR_SHIFT;
>>
>> That ASSERT() will trigger on conventional zones, won't it?
>
> The assert is inside a
>
> if (bio_op(bio) == REQ_OP_ZONE_APPEND) {
>
> btrfs_submit_chunk only sets the op to REQ_OP_ZONE_APPEND when
> btrfs_use_zone_append returns true, which excludes conventional zones.
>

hmm I got that one triggered with fsx:

+ /home/johannes/src/fstests/ltp/fsx -d /mnt/test/test
Seed set to 1
main: filesystem does not support fallocate mode 0, disabling!
main: filesystem does not support fallocate mode FALLOC_FL_KEEP_SIZE, disabling!
main: filesystem does not support fallocate mode FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, disabling!
main: filesystem does not support fallocate mode FALLOC_FL_ZERO_RANGE, disabling!
main: filesystem does not support fallocate mode FALLOC_FL_COLLAPSE_RANGE, disabling!
main: filesystem does not support fallocate mode FALLOC_FL_INSERT_RANGE, disabling!
1 mapwrite 0x27d31 thru 0x3171f (0x99ef bytes)
[ 2.399348] assertion failed: btrfs_dev_is_sequential(dev, physical), in fs/btrfs/volumes.c:7034
[ 2.400881] ------------[ cut here ]------------
[ 2.401677] kernel BUG at fs/btrfs/ctree.h:3772!
[ 2.402463] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
[ 2.402943] CPU: 0 PID: 233 Comm: fsx Not tainted 6.0.0-rc3-raid-stripe-tree-bio-split #313
[ 2.402943] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-1.fc36 04/01/2014
[ 2.402943] RIP: 0010:assertfail.constprop.0+0x18/0x1a [btrfs]
[ 2.402943] Code: 83 ff ff 48 89 d9 48 89 ea 48 c7 c6 48 d9 1d a0 eb e5 89 f1 48 c7 c2 68 51 1d a0 48 89 fe 48 c7 c7 b0 d9 1d a0 e8 83 b0 4f e1 <0f> 0b be bf 16 00 00 48 c7 c7 d8 d9 1d a0 e8 d5 ff ff ff 49 8b 85
[ 2.402943] RSP: 0018:ffffc9000015f8a8 EFLAGS: 00010286
[ 2.402943] RAX: 0000000000000054 RBX: ffff888103f35428 RCX: 0000000000000000
[ 2.402943] RDX: 0000000000000001 RSI: 0000000000000001 RDI: 00000000ffffffff
[ 2.402943] RBP: ffff88811ad33148 R08: 00000000ffffefff R09: 00000000ffffefff
[ 2.402943] R10: ffffffff8203cf80 R11: ffffffff8203cf80 R12: ffff88811ad330c0
[ 2.402943] R13: 0000000000000002 R14: 0000000000000002 R15: ffff8881004957e8
[ 2.402943] FS: 00007f87c5d23740(0000) GS:ffff888627c00000(0000) knlGS:0000000000000000
[ 2.402943] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2.402943] CR2: 00007f87c5ca0000 CR3: 0000000103fa8000 CR4: 00000000000006b0
[ 2.402943] Call Trace:
[ 2.402943] <TASK>
[ 2.402943] btrfs_submit_dev_bio.cold+0x11/0x11 [btrfs]
[ 2.402943] __btrfs_submit_bio+0x8e/0x150 [btrfs]
[ 2.402943] btrfs_submit_chunk+0x12e/0x450 [btrfs]
[ 2.402943] btrfs_submit_bio+0x1e/0x30 [btrfs]
[ 2.402943] submit_one_bio+0x89/0xc0 [btrfs]
[ 2.402943] extent_write_locked_range+0x1d9/0x1f0 [btrfs]
[ 2.402943] run_delalloc_zoned+0x74/0x160 [btrfs]
[ 2.402943] btrfs_run_delalloc_range+0x16f/0x5e0 [btrfs]
[ 2.402943] ? find_lock_delalloc_range+0x27b/0x290 [btrfs]
[ 2.402943] writepage_delalloc+0xb9/0x180 [btrfs]
[ 2.402943] __extent_writepage+0x17f/0x340 [btrfs]
[ 2.402943] extent_write_cache_pages+0x193/0x410 [btrfs]
[ 2.402943] ? rt_mutex_trylock+0x2b/0x90
[ 2.402943] extent_writepages+0x60/0xe0 [btrfs]
[ 2.402943] do_writepages+0xac/0x180
[ 2.402943] ? balance_dirty_pages_ratelimited_flags+0xcd/0xb10
[ 2.402943] ? btrfs_inode_rsv_release+0x52/0xe0 [btrfs]
[ 2.402943] ? preempt_count_add+0x4e/0xb0
[ 2.402943] filemap_fdatawrite_range+0x76/0x80
[ 2.402943] start_ordered_ops.constprop.0+0x37/0x80 [btrfs]
[ 2.402943] btrfs_sync_file+0xb7/0x500 [btrfs]
[ 2.402943] __do_sys_msync+0x1dd/0x310
[ 2.402943] do_syscall_64+0x42/0x90
[ 2.402943] entry_SYSCALL_64_after_hwframe+0x63/0xcd
[ 2.402943] RIP: 0033:0x7f87c5e31197
[ 2.402943] Code: 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 1a 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10
[ 2.402943] RSP: 002b:00007fff06ca0788 EFLAGS: 00000246 ORIG_RAX: 000000000000001a
[ 2.402943] RAX: ffffffffffffffda RBX: 0000000000000d31 RCX: 00007f87c5e31197
[ 2.402943] RDX: 0000000000000004 RSI: 000000000000a720 RDI: 00007f87c5c96000
[ 2.402943] RBP: 0000000000027d31 R08: 0000000000000000 R09: 0000000000027000
[ 2.402943] R10: 00007f87c5d33578 R11: 0000000000000246 R12: 00000000000099ef
[ 2.402943] R13: 000000000000a720 R14: 00007f87c5c96000 R15: 00007f87c5f6b000
[ 2.402943] </TASK>
[ 2.402943] Modules linked in: btrfs blake2b_generic xor lzo_compress zlib_deflate raid6_pq zstd_decompress zstd_compress xxhash null_blk
[ 2.402943] Dumping ftrace buffer:
[ 2.402943] (ftrace buffer empty)