@@ -270,7 +270,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname)
atomic_set(&new_pool->pool_refcount, 1);
rc = lu_tgt_pool_init(&new_pool->pool_obds, 0);
if (rc)
- goto out_err;
+ goto out_free_pool;
/* get ref for debugfs file */
lov_pool_getref(new_pool);
@@ -311,6 +311,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname)
spin_unlock(&obd->obd_dev_lock);
debugfs_remove_recursive(new_pool->pool_debugfs_entry);
lu_tgt_pool_free(&new_pool->pool_obds);
+out_free_pool:
kfree(new_pool);
return rc;
@@ -138,10 +138,6 @@ int lu_tgt_pool_add(struct lu_tgt_pool *op, u32 idx, unsigned int min_count)
down_write(&op->op_rw_sem);
- rc = lu_tgt_pool_extend(op, min_count);
- if (rc)
- goto out;
-
/* search ost in pool array */
for (i = 0; i < op->op_count; i++) {
if (op->op_array[i] == idx) {
@@ -149,6 +145,11 @@ int lu_tgt_pool_add(struct lu_tgt_pool *op, u32 idx, unsigned int min_count)
goto out;
}
}
+
+ rc = lu_tgt_pool_extend(op, min_count);
+ if (rc)
+ goto out;
+
/* ost not found we add it */
op->op_array[op->op_count] = idx;
op->op_count++;