HomeFreeBSD

dbuf_sync_leaf: check DB_READ in state assertions

Description

dbuf_sync_leaf: check DB_READ in state assertions

Block cloning introduced a new state transition from DB_NOFILL to
DB_READ. This occurs when a block is cloned and then read on the
current txg.

In this case, the clone will move the dbuf to DB_NOFILL, and then the
read will be issued for the overidden block pointer. If that read is
still outstanding when it comes time to write, the dbuf will be in
DB_READ, which is not handled by the checks in dbuf_sync_leaf, thus
tripping the assertions.

This updates those checks to allow DB_READ as a valid state iff the
dirty record is for a BRT write and there is a override block pointer.
This is a safe situation because the block already exists, so there's
nothing that could change from underneath the read.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Kay Pedersen <mail@mkwg.de>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Original-patch-by: Kay Pedersen <mail@mkwg.de>
Sponsored-By: OpenDrives Inc.
Sponsored-By: Klara Inc.
Closes #15050

Details

Provenance
rob.norris_klarasystems.comAuthored on Jul 24 2023, 8:02 AM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Jul 24 2023, 11:36 PM
Parents
rGd4edecd1a29f: dmu_buf_will_clone: only check that current txg is clean
Branches
Unknown
Tags
Unknown