From 46492187dd3d11bf99b59b93ebecb7c2b3ca7d46 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 20 Nov 2008 12:51:56 -0800 Subject: [PATCH] Add fix-locks branch --- .topdeps | 1 + .topmsg | 8 ++++++++ zfs/lib/libzpool/arc.c | 1 + zfs/lib/libzpool/dnode.c | 3 +++ zfs/lib/libzpool/spa_misc.c | 2 ++ zfs/lib/libzpool/space_map.c | 3 +++ zfs/lib/libzpool/txg.c | 14 ++++++++++++++ 7 files changed, 32 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..93ff9cbe14 --- /dev/null +++ b/.topmsg @@ -0,0 +1,8 @@ +From: Brian Behlendorf +Subject: [PATCH] fix locks + +Properly initialize and destroy locking primitives. + +Signed-off-by: Brian Behlendorf + +--- diff --git a/zfs/lib/libzpool/arc.c b/zfs/lib/libzpool/arc.c index 8d091b7cea..4725b84cb7 100644 --- a/zfs/lib/libzpool/arc.c +++ b/zfs/lib/libzpool/arc.c @@ -3364,6 +3364,7 @@ arc_fini(void) mutex_destroy(&arc_mru_ghost->arcs_mtx); mutex_destroy(&arc_mfu->arcs_mtx); mutex_destroy(&arc_mfu_ghost->arcs_mtx); + mutex_destroy(&arc_l2c_only->arcs_mtx); buf_fini(); } diff --git a/zfs/lib/libzpool/dnode.c b/zfs/lib/libzpool/dnode.c index 3d40dc2439..6d49924821 100644 --- a/zfs/lib/libzpool/dnode.c +++ b/zfs/lib/libzpool/dnode.c @@ -58,6 +58,8 @@ dnode_cons(void *arg, void *unused, int kmflag) rw_init(&dn->dn_struct_rwlock, NULL, RW_DEFAULT, NULL); mutex_init(&dn->dn_mtx, NULL, MUTEX_DEFAULT, NULL); mutex_init(&dn->dn_dbufs_mtx, NULL, MUTEX_DEFAULT, NULL); + cv_init(&dn->dn_notxholds, NULL, CV_DEFAULT, NULL); + refcount_create(&dn->dn_holds); refcount_create(&dn->dn_tx_holds); @@ -86,6 +88,7 @@ dnode_dest(void *arg, void *unused) rw_destroy(&dn->dn_struct_rwlock); mutex_destroy(&dn->dn_mtx); mutex_destroy(&dn->dn_dbufs_mtx); + cv_destroy(&dn->dn_notxholds); refcount_destroy(&dn->dn_holds); refcount_destroy(&dn->dn_tx_holds); diff --git a/zfs/lib/libzpool/spa_misc.c b/zfs/lib/libzpool/spa_misc.c index 4ec5380384..690e6dbdb6 100644 --- a/zfs/lib/libzpool/spa_misc.c +++ b/zfs/lib/libzpool/spa_misc.c @@ -335,6 +335,7 @@ spa_add(const char *name, const char *altroot) cv_init(&spa->spa_async_cv, NULL, CV_DEFAULT, NULL); cv_init(&spa->spa_scrub_cv, NULL, CV_DEFAULT, NULL); cv_init(&spa->spa_scrub_io_cv, NULL, CV_DEFAULT, NULL); + cv_init(&spa->spa_zio_cv, NULL, CV_DEFAULT, NULL); spa->spa_name = spa_strdup(name); spa->spa_state = POOL_STATE_UNINITIALIZED; @@ -398,6 +399,7 @@ spa_remove(spa_t *spa) cv_destroy(&spa->spa_async_cv); cv_destroy(&spa->spa_scrub_cv); cv_destroy(&spa->spa_scrub_io_cv); + cv_destroy(&spa->spa_zio_cv); mutex_destroy(&spa->spa_uberblock_lock); mutex_destroy(&spa->spa_async_lock); diff --git a/zfs/lib/libzpool/space_map.c b/zfs/lib/libzpool/space_map.c index b1e6bc15fb..33384f4cf9 100644 --- a/zfs/lib/libzpool/space_map.c +++ b/zfs/lib/libzpool/space_map.c @@ -63,6 +63,8 @@ space_map_create(space_map_t *sm, uint64_t start, uint64_t size, uint8_t shift, avl_create(&sm->sm_root, space_map_seg_compare, sizeof (space_seg_t), offsetof(struct space_seg, ss_node)); + cv_init(&sm->sm_load_cv, NULL, CV_DEFAULT, NULL); + sm->sm_start = start; sm->sm_size = size; sm->sm_shift = shift; @@ -74,6 +76,7 @@ space_map_destroy(space_map_t *sm) { ASSERT(!sm->sm_loaded && !sm->sm_loading); VERIFY3U(sm->sm_space, ==, 0); + cv_destroy(&sm->sm_load_cv); avl_destroy(&sm->sm_root); } diff --git a/zfs/lib/libzpool/txg.c b/zfs/lib/libzpool/txg.c index f810a0dc66..e1fe0cca59 100644 --- a/zfs/lib/libzpool/txg.c +++ b/zfs/lib/libzpool/txg.c @@ -72,6 +72,13 @@ txg_init(dsl_pool_t *dp, uint64_t txg) rw_init(&tx->tx_suspend, NULL, RW_DEFAULT, NULL); mutex_init(&tx->tx_sync_lock, NULL, MUTEX_DEFAULT, NULL); + cv_init(&tx->tx_sync_more_cv, NULL, CV_DEFAULT, NULL); + cv_init(&tx->tx_sync_done_cv, NULL, CV_DEFAULT, NULL); + cv_init(&tx->tx_quiesce_more_cv, NULL, CV_DEFAULT, NULL); + cv_init(&tx->tx_quiesce_done_cv, NULL, CV_DEFAULT, NULL); + cv_init(&tx->tx_timeout_cv, NULL, CV_DEFAULT, NULL); + cv_init(&tx->tx_exit_cv, NULL, CV_DEFAULT, NULL); + tx->tx_open_txg = txg; } @@ -86,6 +93,13 @@ txg_fini(dsl_pool_t *dp) ASSERT(tx->tx_threads == 0); + cv_destroy(&tx->tx_sync_more_cv); + cv_destroy(&tx->tx_sync_done_cv); + cv_destroy(&tx->tx_quiesce_more_cv); + cv_destroy(&tx->tx_quiesce_done_cv); + cv_destroy(&tx->tx_timeout_cv); + cv_destroy(&tx->tx_exit_cv); + rw_destroy(&tx->tx_suspend); mutex_destroy(&tx->tx_sync_lock);