HomeFreeBSD

zap: reuse zap_leaf_t on dbuf reuse after shrink

Description

zap: reuse zap_leaf_t on dbuf reuse after shrink

If a shrink or truncate had recently freed a portion of the ZAP, the
dbuf could still be sitting on the dbuf cache waiting for eviction. If
it is then allocated for a new leaf before it can be evicted, the
zap_leaf_t is still attached as userdata, tripping the VERIFY.

Instead, just check for the userdata, and if we find it, reuse it.

Sponsored-by: Klara, Inc.
Sponsored-by: iXsystems, Inc.
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #16157.
Closes #16204

Details

Provenance
rob.norris_klarasystems.comAuthored on May 25 2024, 1:55 AM
GitHub <noreply@github.com>Committed on May 25 2024, 1:55 AM
Parents
rG708be0f415c8: Linux 6.7 compat: detect if kernel defines intptr_t
Branches
Unknown
Tags
Unknown