X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Flov%2Flov_pool.c;h=f63fac745b4ec580e5517c5267c09f5471d58b41;hb=9edebe083264464d2692da446f68483e3e45a80d;hp=fe557946defa60f7e248e940114bc1b8bf707a37;hpb=90a8375bf34ccdd5adcc514cfefed3871d0fbb73;p=fs%2Flustre-release.git diff --git a/lustre/lov/lov_pool.c b/lustre/lov/lov_pool.c index fe55794..f63fac7 100644 --- a/lustre/lov/lov_pool.c +++ b/lustre/lov/lov_pool.c @@ -280,7 +280,7 @@ int lov_ost_pool_init(struct ost_pool *op, unsigned int count) count = LOV_POOL_INIT_COUNT; op->op_array = NULL; op->op_count = 0; - op->op_rwlock = RW_LOCK_UNLOCKED; + rwlock_init(&op->op_rwlock); op->op_size = count; OBD_ALLOC(op->op_array, op->op_size * sizeof(op->op_array[0])); if (op->op_array == NULL) { @@ -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);