mirror_zfs/module
Ameer Hamza b8610c3d93 L2ARC: Reorder header destruction for in-flight L2 writes
With multiple L2ARC devices, headers can be destroyed asynchronously
(e.g., during zpool sync) while L2_WRITING is set. The original code
destroyed L2HDR before L1HDR, causing ABDs to lose their device
association (b_l2hdr.b_dev) when arc_hdr_free_abd() is called.

This caused ABDs to be added to the global free-on-write list without
device information. When any L2ARC device completed its write and
attempted to free these orphaned ABDs, it would panic on
ASSERT(!list_link_active(&abd->abd_gang_link)) because the ABD was
still part of another device's vdev_queue I/O aggregation gang.

Fix by extending l2ad_mtx lock scope to cover L1HDR destruction and
reordering to destroy L1HDR before L2HDR when L2_WRITING is set. This
ensures arc_hdr_free_abd() can access b_l2hdr.b_dev to properly tag
ABDs with their device for deferred cleanup.

Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Closes #18093
2026-02-04 10:06:51 -08:00
..
avl Prefer VERIFY0P(n) over VERIFY(n == NULL) 2025-08-07 11:41:37 -07:00
icp icp: emit .note.GNU-stack section for all ELF targets 2026-01-08 09:21:12 -08:00
lua SPDX: license tags: MIT 2025-03-13 17:56:54 -07:00
nvpair nvpair: chase FreeBSD xdrproc_t definition 2026-01-28 21:41:33 -05:00
os remove thread unsafe debug code causing FreeBSD double free panic 2026-01-21 10:00:34 -08:00
zcommon Add snapshots_changed_nsecs dataset property 2026-01-06 09:36:20 -08:00
zfs L2ARC: Reorder header destruction for in-flight L2 writes 2026-02-04 10:06:51 -08:00
zstd Zstd: Document update policy 2026-01-20 13:41:24 -08:00
.gitignore FreeBSD: Ignore symlink to i386 includes 2022-08-02 16:34:23 -07:00
Kbuild.in Zstd: Integrate v1.5.7 into the ZFS build system 2026-01-20 13:41:06 -08:00
Makefile.bsd Zstd: Integrate v1.5.7 into the ZFS build system 2026-01-20 13:41:06 -08:00
Makefile.in Fix --enable-invariants on FreeBSD 2026-01-14 14:54:12 -08:00