Johannes Thumshirn
082b3d4e78
btrfs: zoned: allocate dummy checksums for zoned NODATASUM writes
...
[ Upstream commit cebae292e0c32a228e8f2219c270a7237be24a6a ]
Shin'ichiro reported that when he's running fstests' test-case
btrfs/167 on emulated zoned devices, he's seeing the following NULL
pointer dereference in 'btrfs_zone_finish_endio()':
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000011: 0000 [#1 ] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000088-0x000000000000008f]
CPU: 4 PID: 2332440 Comm: kworker/u80:15 Tainted: G W 6.10.0-rc2-kts+ #4
Hardware name: Supermicro Super Server/X11SPi-TF, BIOS 3.3 02/21/2020
Workqueue: btrfs-endio-write btrfs_work_helper [btrfs]
RIP: 0010:btrfs_zone_finish_endio.part.0+0x34/0x160 [btrfs]
RSP: 0018:ffff88867f107a90 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff893e5534
RDX: 0000000000000011 RSI: 0000000000000004 RDI: 0000000000000088
RBP: 0000000000000002 R08: 0000000000000001 R09: ffffed1081696028
R10: ffff88840b4b0143 R11: ffff88834dfff600 R12: ffff88840b4b0000
R13: 0000000000020000 R14: 0000000000000000 R15: ffff888530ad5210
FS: 0000000000000000(0000) GS:ffff888e3f800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f87223fff38 CR3: 00000007a7c6a002 CR4: 00000000007706f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
<TASK>
? __die_body.cold+0x19/0x27
? die_addr+0x46/0x70
? exc_general_protection+0x14f/0x250
? asm_exc_general_protection+0x26/0x30
? do_raw_read_unlock+0x44/0x70
? btrfs_zone_finish_endio.part.0+0x34/0x160 [btrfs]
btrfs_finish_one_ordered+0x5d9/0x19a0 [btrfs]
? __pfx_lock_release+0x10/0x10
? do_raw_write_lock+0x90/0x260
? __pfx_do_raw_write_lock+0x10/0x10
? __pfx_btrfs_finish_one_ordered+0x10/0x10 [btrfs]
? _raw_write_unlock+0x23/0x40
? btrfs_finish_ordered_zoned+0x5a9/0x850 [btrfs]
? lock_acquire+0x435/0x500
btrfs_work_helper+0x1b1/0xa70 [btrfs]
? __schedule+0x10a8/0x60b0
? __pfx___might_resched+0x10/0x10
process_one_work+0x862/0x1410
? __pfx_lock_acquire+0x10/0x10
? __pfx_process_one_work+0x10/0x10
? assign_work+0x16c/0x240
worker_thread+0x5e6/0x1010
? __pfx_worker_thread+0x10/0x10
kthread+0x2c3/0x3a0
? trace_irq_enable.constprop.0+0xce/0x110
? __pfx_kthread+0x10/0x10
ret_from_fork+0x31/0x70
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1a/0x30
</TASK>
Enabling CONFIG_BTRFS_ASSERT revealed the following assertion to
trigger:
assertion failed: !list_empty(&ordered->list), in fs/btrfs/zoned.c:1815
This indicates, that we're missing the checksums list on the
ordered_extent. As btrfs/167 is doing a NOCOW write this is to be
expected.
Further analysis with drgn confirmed the assumption:
>>> inode = prog.crashed_thread().stack_trace()[11]['ordered'].inode
>>> btrfs_inode = drgn.container_of(inode, "struct btrfs_inode", \
"vfs_inode")
>>> print(btrfs_inode.flags)
(u32)1
As zoned emulation mode simulates conventional zones on regular devices,
we cannot use zone-append for writing. But we're only attaching dummy
checksums if we're doing a zone-append write.
So for NOCOW zoned data writes on conventional zones, also attach a
dummy checksum.
Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fixes: cbfce4c7fbde ("btrfs: optimize the logical to physical mapping for zoned writes")
CC: Naohiro Aota <Naohiro.Aota@wdc.com> # 6.6+
Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-27 13:49:06 +02:00
..
2024-06-16 13:47:37 +02:00
2023-08-29 20:21:42 -07:00
2023-08-29 20:21:42 -07:00
2024-06-16 13:47:30 +02:00
2023-08-28 11:39:14 -07:00
2023-08-29 20:21:42 -07:00
2023-08-29 20:21:42 -07:00
2024-06-27 13:49:06 +02:00
2024-06-21 14:38:47 +02:00
2024-04-27 17:11:29 +02:00
2023-08-28 09:31:32 -07:00
2023-07-13 10:28:05 +02:00
2023-08-28 11:04:18 -07:00
2024-01-20 11:51:37 +01:00
2023-08-28 10:17:14 -07:00
2024-06-12 11:11:38 +02:00
2024-06-12 11:11:31 +02:00
2024-03-06 14:48:41 +00:00
2023-08-29 20:21:42 -07:00
2024-06-16 13:47:31 +02:00
2023-11-28 17:19:44 +00:00
2023-08-29 17:45:22 -04:00
2024-03-26 18:19:46 -04:00
2024-06-27 13:49:03 +02:00
2024-06-27 13:49:04 +02:00
2024-04-03 15:28:20 +02:00
2023-08-29 20:21:42 -07:00
2024-01-31 16:19:01 -08:00
2024-04-27 17:11:42 +02:00
2024-06-12 11:12:52 +02:00
2023-08-29 20:21:42 -07:00
2023-08-29 20:21:42 -07:00
2023-07-24 10:30:00 +02:00
2023-08-29 20:21:42 -07:00
2024-02-23 09:25:16 +01:00
2024-06-16 13:47:40 +02:00
2024-04-13 13:07:34 +02:00
2024-01-20 11:51:43 +01:00
2024-06-12 11:11:33 +02:00
2024-06-21 14:38:24 +02:00
2024-04-13 13:07:38 +02:00
2023-08-29 17:45:22 -04:00
2023-08-29 20:21:42 -07:00
2023-09-18 12:03:46 -07:00
2024-06-21 14:38:29 +02:00
2024-06-21 14:38:40 +02:00
2024-06-21 14:38:46 +02:00
2023-08-31 12:07:34 -05:00
2023-10-19 16:19:20 +02:00
2023-08-29 20:21:42 -07:00
2024-06-12 11:12:39 +02:00
2024-06-21 14:38:41 +02:00
2023-08-29 20:21:42 -07:00
2024-06-12 11:11:30 +02:00
2024-04-13 13:07:35 +02:00
2024-06-12 11:12:24 +02:00
2024-06-21 14:38:41 +02:00
2024-04-13 13:07:31 +02:00
2023-08-29 20:21:42 -07:00
2023-08-29 20:21:42 -07:00
2024-03-26 18:19:46 -04:00
2023-07-24 10:30:04 +02:00
2024-03-26 18:19:46 -04:00
2023-08-29 20:21:42 -07:00
2024-06-21 14:38:36 +02:00
2024-05-02 16:32:41 +02:00
2024-04-27 17:11:41 +02:00
2024-04-13 13:07:34 +02:00
2024-06-21 14:38:22 +02:00
2024-04-03 15:28:20 +02:00
2024-06-27 13:49:04 +02:00
2023-08-29 20:21:42 -07:00
2024-05-17 12:02:13 +02:00
2024-06-16 13:47:33 +02:00
2024-06-21 14:38:45 +02:00
2024-02-23 09:25:13 +01:00
2024-04-03 15:28:44 +02:00
2023-08-28 10:17:14 -07:00
2023-08-11 09:04:57 +02:00
2023-09-29 17:20:45 -07:00
2023-06-28 20:35:21 -07:00
2023-07-13 10:28:04 +02:00
2023-09-25 08:55:00 -07:00
2024-01-10 17:16:53 +01:00
2024-02-05 20:14:26 +00:00
2023-06-28 10:28:11 -07:00
2023-08-18 10:12:11 -07:00
2023-07-11 11:41:34 +02:00
2024-06-12 11:11:30 +02:00
2024-04-03 15:28:55 +02:00
2024-03-26 18:19:17 -04:00
2024-03-26 18:19:15 -04:00
2023-08-08 19:36:51 +02:00
2023-08-28 10:17:14 -07:00
2023-10-12 18:53:36 +03:00
2023-08-21 13:46:25 -07:00
2024-06-27 13:49:00 +02:00
2023-08-14 18:48:02 +02:00
2023-12-03 07:33:03 +01:00
2023-08-29 20:21:42 -07:00
2024-01-31 16:18:54 -08:00
2023-08-29 20:21:42 -07:00
2023-08-23 14:17:43 -07:00
2023-08-19 12:12:12 +02:00
2024-01-05 15:19:40 +01:00
2023-08-31 15:32:18 -07:00
2023-08-02 09:13:09 -06:00
2024-01-31 16:18:57 -08:00
2024-02-23 09:25:15 +01:00
2023-07-13 10:28:04 +02:00
2023-12-20 17:01:51 +01:00
2024-04-10 16:35:57 +02:00
2023-07-13 10:28:04 +02:00
2023-08-15 08:32:45 +02:00
2023-08-06 15:08:35 +02:00
2024-03-26 18:19:17 -04:00
2023-08-29 14:25:26 -07:00
2023-07-13 10:28:04 +02:00
2023-12-03 07:33:03 +01:00
2023-08-31 12:47:15 +02:00
2024-05-17 12:02:36 +02:00
2023-08-22 10:57:46 +02:00