aboutsummaryrefslogtreecommitdiffstats
path: root/uts
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2019-06-03 17:11:26 +0000
committerAlexander Motin <mav@FreeBSD.org>2019-06-03 17:11:26 +0000
commit08bd25db92d3e52e2eae5d5dc3a0fc04ae970164 (patch)
tree0d5d3844707c6a55235fb14f7e9b97ee0344972d /uts
parentaf9de5b9f4766c217d1e7d64c3811305a7b2f0b1 (diff)
downloadsrc-08bd25db92d3e52e2eae5d5dc3a0fc04ae970164.tar.gz
src-08bd25db92d3e52e2eae5d5dc3a0fc04ae970164.zip
9688 aggsum_fini leaks memory
illumos/illumos-gate@29bf2d68bef208274f5a54a14cc80c4a8cb76f53 Reviewed by: Serapheim Dimitropoulos <serapheim.dimitro@delphix.com> Reviewed by: Matt Ahrens <matt@delphix.com> Reviewed by: Prashanth Sreenivasa <pks@delphix.com> Reviewed by: Jorgen Lundman <lundman@lundman.net> Reviewed by: Igor Kozhukhov <igor@dilos.org> Approved by: Robert Mustacchi <rm@joyent.com> Author: Paul Dagnelie <pcd@delphix.com>
Notes
Notes: svn path=/vendor-sys/illumos/dist/; revision=348554
Diffstat (limited to 'uts')
-rw-r--r--uts/common/fs/zfs/aggsum.c3
-rw-r--r--uts/common/fs/zfs/arc.c15
2 files changed, 16 insertions, 2 deletions
diff --git a/uts/common/fs/zfs/aggsum.c b/uts/common/fs/zfs/aggsum.c
index 814f6c276b0a..c4e78e2a6d37 100644
--- a/uts/common/fs/zfs/aggsum.c
+++ b/uts/common/fs/zfs/aggsum.c
@@ -13,7 +13,7 @@
* CDDL HEADER END
*/
/*
- * Copyright (c) 2017 by Delphix. All rights reserved.
+ * Copyright (c) 2017, 2018 by Delphix. All rights reserved.
*/
#include <sys/zfs_context.h>
@@ -99,6 +99,7 @@ aggsum_fini(aggsum_t *as)
{
for (int i = 0; i < as->as_numbuckets; i++)
mutex_destroy(&as->as_buckets[i].asc_lock);
+ kmem_free(as->as_buckets, as->as_numbuckets * sizeof (aggsum_bucket_t));
mutex_destroy(&as->as_lock);
}
diff --git a/uts/common/fs/zfs/arc.c b/uts/common/fs/zfs/arc.c
index 8fa98b14f091..12f0e4a70998 100644
--- a/uts/common/fs/zfs/arc.c
+++ b/uts/common/fs/zfs/arc.c
@@ -6159,6 +6159,14 @@ arc_state_fini(void)
multilist_destroy(arc_mru_ghost->arcs_list[ARC_BUFC_DATA]);
multilist_destroy(arc_mfu->arcs_list[ARC_BUFC_DATA]);
multilist_destroy(arc_mfu_ghost->arcs_list[ARC_BUFC_DATA]);
+
+ aggsum_fini(&arc_meta_used);
+ aggsum_fini(&arc_size);
+ aggsum_fini(&astat_data_size);
+ aggsum_fini(&astat_metadata_size);
+ aggsum_fini(&astat_hdr_size);
+ aggsum_fini(&astat_other_size);
+ aggsum_fini(&astat_l2_hdr_size);
}
uint64_t
@@ -6328,8 +6336,13 @@ arc_fini(void)
mutex_destroy(&arc_adjust_lock);
cv_destroy(&arc_adjust_waiters_cv);
- arc_state_fini();
+ /*
+ * buf_fini() must proceed arc_state_fini() because buf_fin() may
+ * trigger the release of kmem magazines, which can callback to
+ * arc_space_return() which accesses aggsums freed in act_state_fini().
+ */
buf_fini();
+ arc_state_fini();
ASSERT0(arc_loaned_bytes);
}