aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/refcount.c
diff options
context:
space:
mode:
Diffstat (limited to 'module/zfs/refcount.c')
-rw-r--r--module/zfs/refcount.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/module/zfs/refcount.c b/module/zfs/refcount.c
index 0a93aafb1..bcaa6d387 100644
--- a/module/zfs/refcount.c
+++ b/module/zfs/refcount.c
@@ -234,8 +234,8 @@ zfs_refcount_transfer(zfs_refcount_t *dst, zfs_refcount_t *src)
}
void
-zfs_refcount_transfer_ownership(zfs_refcount_t *rc, void *current_holder,
- void *new_holder)
+zfs_refcount_transfer_ownership_many(zfs_refcount_t *rc, uint64_t number,
+ void *current_holder, void *new_holder)
{
reference_t *ref;
boolean_t found = B_FALSE;
@@ -248,7 +248,8 @@ zfs_refcount_transfer_ownership(zfs_refcount_t *rc, void *current_holder,
for (ref = list_head(&rc->rc_list); ref;
ref = list_next(&rc->rc_list, ref)) {
- if (ref->ref_holder == current_holder) {
+ if (ref->ref_holder == current_holder &&
+ ref->ref_number == number) {
ref->ref_holder = new_holder;
found = B_TRUE;
break;
@@ -258,6 +259,14 @@ zfs_refcount_transfer_ownership(zfs_refcount_t *rc, void *current_holder,
mutex_exit(&rc->rc_mtx);
}
+void
+zfs_refcount_transfer_ownership(zfs_refcount_t *rc, void *current_holder,
+ void *new_holder)
+{
+ return (zfs_refcount_transfer_ownership_many(rc, 1, current_holder,
+ new_holder));
+}
+
/*
* If tracking is enabled, return true if a reference exists that matches
* the "holder" tag. If tracking is disabled, then return true if a reference