Fix regression in dmu_buf_will_fill()
commit6e3c109bc007597692054c66675b8f45b76744a4
authorAlexander Motin <mav@FreeBSD.org>
Tue, 3 Dec 2024 01:08:40 +0000 (2 20:08 -0500)
committerGitHub <noreply@github.com>
Tue, 3 Dec 2024 01:08:40 +0000 (2 17:08 -0800)
treed2aa64ca4e42b4be11e71b393499b8beaf97ab87
parent3e9ba0f223b3a48d1537c5f51cca201aef0cf87f
Fix regression in dmu_buf_will_fill()

Direct I/O implementation added condition to call dbuf_undirty()
only in case of block cloning.  But the condition is not right if
the block is no longer dirty in this TXG, but still in DB_NOFILL
state.  It resulted in block not reverting to DB_UNCACHED and
following NULL de-reference on attempt to access absent db_data.

While there, add assertions for db_data to make debugging easier.

Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #16829
module/os/freebsd/zfs/dmu_os.c
module/zfs/dbuf.c
module/zfs/dmu.c