From 4e9ae1370a5c20007f465e9c433d6a21cb571d9b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 20 Nov 2008 12:52:09 -0800 Subject: [PATCH] Add fix-dbuf_dirty_record_t branch --- .topdeps | 1 + .topmsg | 8 ++++++++ zfs/lib/libzpool/dbuf.c | 4 ++++ zfs/lib/libzpool/dnode_sync.c | 2 ++ zfs/lib/libzpool/zfs_znode.c | 2 ++ 5 files changed, 17 insertions(+) create mode 100644 .topdeps create mode 100644 .topmsg diff --git a/.topdeps b/.topdeps new file mode 100644 index 0000000000..1f7391f92b --- /dev/null +++ b/.topdeps @@ -0,0 +1 @@ +master diff --git a/.topmsg b/.topmsg new file mode 100644 index 0000000000..a3339ab6cd --- /dev/null +++ b/.topmsg @@ -0,0 +1,8 @@ +From: Brian Behlendorf +Subject: [PATCH] fix dbuf_dirty_record_t + +Fix two leaks with dbuf_dirty_record_t + +Signed-off-by: Brian Behlendorf + +--- diff --git a/zfs/lib/libzpool/dbuf.c b/zfs/lib/libzpool/dbuf.c index 08d17fb586..7c488404ce 100644 --- a/zfs/lib/libzpool/dbuf.c +++ b/zfs/lib/libzpool/dbuf.c @@ -1929,6 +1929,10 @@ dbuf_sync_leaf(dbuf_dirty_record_t *dr, dmu_tx_t *tx) drp = &(*drp)->dr_next; ASSERT(dr->dr_next == NULL); *drp = dr->dr_next; + if (dr->dr_dbuf->db_level != 0) { + mutex_destroy(&dr->dt.di.dr_mtx); + list_destroy(&dr->dt.di.dr_children); + } kmem_free(dr, sizeof (dbuf_dirty_record_t)); ASSERT(db->db_dirtycnt > 0); db->db_dirtycnt -= 1; diff --git a/zfs/lib/libzpool/dnode_sync.c b/zfs/lib/libzpool/dnode_sync.c index 0fdd27ecf0..986bed486b 100644 --- a/zfs/lib/libzpool/dnode_sync.c +++ b/zfs/lib/libzpool/dnode_sync.c @@ -429,6 +429,8 @@ dnode_undirty_dbufs(list_t *list) } else { mutex_exit(&db->db_mtx); dnode_undirty_dbufs(&dr->dt.di.dr_children); + mutex_destroy(&dr->dt.di.dr_mtx); + list_destroy(&dr->dt.di.dr_children); } kmem_free(dr, sizeof (dbuf_dirty_record_t)); dbuf_rele(db, (void *)(uintptr_t)txg); diff --git a/zfs/lib/libzpool/zfs_znode.c b/zfs/lib/libzpool/zfs_znode.c index 18ab8350f9..79cff5fd8c 100644 --- a/zfs/lib/libzpool/zfs_znode.c +++ b/zfs/lib/libzpool/zfs_znode.c @@ -1296,6 +1296,8 @@ zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx) if (sense == ZFS_CASE_INSENSITIVE || sense == ZFS_CASE_MIXED) zfsvfs.z_norm |= U8_TEXTPREP_TOUPPER; + /* XXX - This must be destroyed but I'm not quite sure yet so + * I'm just annotating that fact when it's an issue. -Brian */ mutex_init(&zfsvfs.z_znodes_lock, NULL, MUTEX_DEFAULT, NULL); list_create(&zfsvfs.z_all_znodes, sizeof (znode_t), offsetof(znode_t, z_link_node));