Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing failed ASSERT in dbuf_unoverride()
995734e added a test for block cloning with mmap files. As a result I began hitting a panic in that test in dbuf_unoverride(). The was if the dirty record was from a cloned block, then the dr_data must be set to NULL. This ASSERT was added in 86e115e. The point of that commit was to make sure that if a cloned block is read before it is synced out, then the associated ARC buffer is set in the dirty record. This became an issue with the O_DIRECT code, because dr_data was set to the ARC buf in dbuf_set_data() after the read. This is the incorrect logic though for the cloned block. In order to fix this issue, I refined how to determine if the dirty record is in fact from a O_DIRECT write by make sure that dr_brtwrite is false. I created the function dbuf_dirty_is_direct_write() to perform the proper check. As part of this, I also cleaned up other code that did the exact same check for an O_DIRECT write to make sure the proper check is taking place everywhere. The trace of the ASSERT that was being tripped before this change is below: [3649972.811039] VERIFY0P(dr->dt.dl.dr_data) failed (NULL == ffff8d58e8183c80) [3649972.817999] PANIC at dbuf.c:1999:dbuf_unoverride() [3649972.822968] Showing stack for process 2365657 [3649972.827502] CPU: 0 PID: 2365657 Comm: clone_mmap_writ Kdump: loaded Tainted: P OE --------- - - 4.18.0-408.el8.x86_64 openzfs#1 [3649972.839749] Hardware name: GIGABYTE R272-Z32-00/MZ32-AR0-00, BIOS R21 10/08/2020 [3649972.847315] Call Trace: [3649972.849935] dump_stack+0x41/0x60 [3649972.853428] spl_panic+0xd0/0xe8 [spl] [3649972.857370] ? cityhash4+0x75/0x90 [zfs] [3649972.861649] ? _cond_resched+0x15/0x30 [3649972.865577] ? spl_kmem_alloc_impl+0xce/0xf0 [spl] [3649972.870548] ? __kmalloc_node+0x10d/0x300 [3649972.874735] ? spl_kmem_alloc_impl+0xce/0xf0 [spl] [3649972.879702] ? __list_add+0x12/0x30 [zfs] [3649972.884061] dbuf_unoverride+0x1c1/0x1d0 [zfs] [3649972.888856] dbuf_redirty+0x3b/0xd0 [zfs] [3649972.893204] dbuf_dirty+0xeb1/0x1330 [zfs] [3649972.897643] ? _cond_resched+0x15/0x30 [3649972.901569] ? mutex_lock+0xe/0x30 [3649972.905148] ? dbuf_noread+0x117/0x240 [zfs] [3649972.909760] dmu_write_uio_dnode+0x1d2/0x320 [zfs] [3649972.914900] dmu_write_uio_dbuf+0x47/0x60 [zfs] [3649972.919777] zfs_write+0x57d/0xe00 [zfs] [3649972.924076] ? alloc_set_pte+0xb8/0x3e0 [3649972.928088] zpl_iter_write_buffered+0xb2/0x120 [zfs] [3649972.933507] ? rrw_exit+0xc6/0x200 [zfs] [3649972.937796] zpl_iter_write+0xba/0x110 [zfs] [3649972.942433] new_sync_write+0x112/0x160 [3649972.946445] vfs_write+0xa5/0x1a0 [3649972.949935] ksys_pwrite64+0x61/0xa0 [3649972.953681] do_syscall_64+0x5b/0x1a0 [3649972.957519] entry_SYSCALL_64_after_hwframe+0x65/0xca [3649972.962745] RIP: 0033:0x7f610616f01b Signed-off-by: Brian Atkinson <[email protected]>
- Loading branch information