aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/dmu_zfetch.c
diff options
context:
space:
mode:
authorRich Ercolani <[email protected]>2021-10-08 14:10:34 -0400
committerGitHub <[email protected]>2021-10-08 11:10:34 -0700
commit9d1407e8f24825d74ba7cf228de545c0d1a0ce8f (patch)
tree73ac600a35bf97b404b0177621cd6a63741b39c5 /module/zfs/dmu_zfetch.c
parent2d02bba23d83ae8fede8d281edc255f01ccd28e9 (diff)
Correct refcount_add in dmu_zfetch
refcount_add_many(foo,N) is not the same as for (i=0; i < N; i++) { refcount_add(foo); } Unfortunately, this is only actually true with debug kernels and reference_tracking_enable=1. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Rich Ercolani <[email protected]> Closes #12589 Closes #12602
Diffstat (limited to 'module/zfs/dmu_zfetch.c')
-rw-r--r--module/zfs/dmu_zfetch.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/module/zfs/dmu_zfetch.c b/module/zfs/dmu_zfetch.c
index a26b0d739..043344a13 100644
--- a/module/zfs/dmu_zfetch.c
+++ b/module/zfs/dmu_zfetch.c
@@ -488,7 +488,8 @@ dmu_zfetch_run(zstream_t *zs, boolean_t missed, boolean_t have_lock)
issued = pf_end - pf_start + ipf_end - ipf_start;
if (issued > 1) {
/* More references on top of taken in dmu_zfetch_prepare(). */
- zfs_refcount_add_many(&zs->zs_refs, issued - 1, NULL);
+ for (int i = 0; i < issued - 1; i++)
+ zfs_refcount_add(&zs->zs_refs, NULL);
} else if (issued == 0) {
/* Some other thread has done our work, so drop the ref. */
if (zfs_refcount_remove(&zs->zs_refs, NULL) == 0)