]> git.proxmox.com Git - mirror_zfs.git/commit - include/sys/refcount.h
Add zfs_refcount_transfer_ownership_many()
authorBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 8 Oct 2018 21:58:21 +0000 (14:58 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 9 Oct 2018 17:05:48 +0000 (10:05 -0700)
commitd7e4b30a672c1d7eb77dbbe2cdcf14cac102839a
treee9d61baf611a5479fd047b7170b67ea57dd2abf7
parent4cbde2ecbf7c6478bac106fadd6a23f53d538262
Add zfs_refcount_transfer_ownership_many()

When debugging is enabled and a zfs_refcount_t contains multiple holders
using the same key, but different ref_counts, the wrong reference_t may
be transferred.  Add a zfs_refcount_transfer_ownership_many() function,
like the existing zfs_refcount_*_many() functions, to match and transfer
the correct refcount_t;

This issue may occur when using encryption with refcount debugging
enabled.  An arc_buf_hdr_t can have references for both the
hdr->b_l1hdr.b_pabd and hdr->b_crypt_hdr.b_rabd both of which use
the hdr as the reference holder.  When unsharing the buffer the
p_abd should be transferred.

This issue does not impact production builds because refcount holders
are not tracked.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #7219
Closes #8000
include/sys/refcount.h
module/zfs/arc.c
module/zfs/refcount.c