HomeFreeBSD

dbuf: separate refcount calls for dbuf and dbuf_user

Description

dbuf: separate refcount calls for dbuf and dbuf_user

In 92dc4ad83 I updated the dbuf_cache accounting to track the size of
userdata associated with dbufs. This adds the size of the dbuf+userdata
together in a single call to zfs_refcount_add_many(), but sometime
removes them in separate calls to zfs_refcount_remove_many(), if dbuf
and userdata are evicted separately.

What I didn't realise is that when refcount tracking is on,
zfs_refcount_add_many() and zfs_refcount_remove_many() are expected to
be paired, with their second & third args (count & holder) the same on
both sides. Splitting the remove part into two calls means the counts
don't match up, tripping a panic.

This commit fixes that, by always adding and removing the dbuf and
userdata counts separately.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reported-by: Mark Johnston <markj@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #16191

Details

Provenance
rob.norris_klarasystems.comAuthored on May 15 2024, 8:03 PM
GitHub <noreply@github.com>Committed on May 15 2024, 8:03 PM
Parents
rG3c941d181834: zdb/ztest: send dbgmsg output to stderr
Branches
Unknown
Tags
Unknown