]> granicus.if.org Git - zfs/commitdiff
OpenZFS 9688 - aggsum_fini leaks memory
authorPaul Dagnelie <pcd@delphix.com>
Wed, 23 May 2018 17:32:31 +0000 (10:32 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 19 Oct 2018 19:08:03 +0000 (12:08 -0700)
Porting Notes:
- Most of these fixes were applied in the original 37fb3e43
  commit when this change was ported for Linux.

Authored by: Paul Dagnelie <pcd@delphix.com>
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>
Reviewed by: George Melikov <mail@gmelikov.ru>
Approved by: Robert Mustacchi <rm@joyent.com>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
OpenZFS-issue: https://www.illumos.org/issues/9688
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/29bf2d68be
Closes #8042

module/zfs/aggsum.c
module/zfs/arc.c

index 8d310e0043fe4b85a9cf6176a2decb2efd93a26c..ace3a83a5d8bc5a02751d41aabb57538e923d7b0 100644 (file)
@@ -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>
index 07612468dcb5dbaeb1f5a30273a239ed3c37b5ce..96557054cc60d23b23356cd2672814efd376347f 100644 (file)
@@ -7845,8 +7845,13 @@ arc_fini(void)
        cv_destroy(&arc_reclaim_thread_cv);
        cv_destroy(&arc_reclaim_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);
 }