From: yury Date: Fri, 7 Nov 2008 21:10:51 +0000 (+0000) Subject: b=17511 X-Git-Tag: v1_7_140~1^23 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=97345e5064e56e934e90beb5af5ecba5438bb513;p=fs%2Flustre-release.git b=17511 r=johann,adilger - removes deadlock possibility by disabling rehash in hash_del() operations and moving hash_add() out of spin_locks when calling. Hash table has own mechanisms for protecting its structures and it also has hash_add_unique() method for using in concurrent run contexts; - fixed missed lh_put() in hash_add_unique() which led to extra refs in some cases (extra ref to export) and inability to cleanup; - fixed __lustre_hash_set_theta() which set @max theta into ->lh_min_theta; - in lustre_hash_rehash_size() disable rehash also for the case when new and old hash sizes equal in corner cases (max_size or min_size). Before this fix it could be possible to do needless rehashes when size is actually did not change but we do this expensive operation; - disable rehash in hash_add_unique() if no actual add happened since entry with the same key is already found in the table; - some cleanups in hash table code; --- diff --git a/lustre/lov/lov_pool.c b/lustre/lov/lov_pool.c index eb3f0d4..19361a8 100644 --- a/lustre/lov/lov_pool.c +++ b/lustre/lov/lov_pool.c @@ -400,18 +400,16 @@ int lov_pool_new(struct obd_device *obd, char *poolname) GOTO(out_err, rc); } - spin_lock(&obd->obd_dev_lock); - /* check if pool already exists */ - if (lustre_hash_lookup(lov->lov_pools_hash_body, poolname) != NULL) { - spin_unlock(&obd->obd_dev_lock); + INIT_HLIST_NODE(&new_pool->pool_hash); + rc = lustre_hash_add_unique(lov->lov_pools_hash_body, poolname, + &new_pool->pool_hash); + if (rc) { lov_ost_pool_free(&new_pool->pool_rr.lqr_pool); lov_ost_pool_free(&new_pool->pool_obds); GOTO(out_err, rc = -EEXIST); } - INIT_HLIST_NODE(&new_pool->pool_hash); - lustre_hash_add_unique(lov->lov_pools_hash_body, poolname, - &new_pool->pool_hash); + spin_lock(&obd->obd_dev_lock); list_add_tail(&new_pool->pool_list, &lov->lov_pool_list); lov->lov_pool_count++; spin_unlock(&obd->obd_dev_lock);