[lustre-devel] [PATCH 10/15] lustre: lov: fix error handling in lov_new_pool
James Simmons
jsimmons at infradead.org
Mon Nov 8 07:07:38 PST 2021
From: Sergey Cheremencev <sergey.cheremencev at hpe.com>
- correct error handling in lov_new_pool - ENOMEM
from tgt_pool_init may cause incorrect pool_count.
- optimisation in lu_tgt_pool_add. Do not extend
a pool, if the target is already exists.
HPE-bug-id: LUS-6995
WC-bug-id: https://jira.whamcloud.com/browse/LU-15067
Lustre-commit: b6ac7490f3a30c80d ("LU-15067 lod: fix error handling in lod_new_pool")
Signed-off-by: Sergey Cheremencev <sergey.cheremencev at hpe.com>
Reviewed-on: https://review.whamcloud.com/45137
Reviewed-by: Alexander Zarochentsev <c17826 at cray.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko at hpe.com>
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
fs/lustre/lov/lov_pool.c | 3 ++-
fs/lustre/obdclass/lu_tgt_pool.c | 9 +++++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/fs/lustre/lov/lov_pool.c b/fs/lustre/lov/lov_pool.c
index 25e980f..267ac2d 100644
--- a/fs/lustre/lov/lov_pool.c
+++ b/fs/lustre/lov/lov_pool.c
@@ -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;
diff --git a/fs/lustre/obdclass/lu_tgt_pool.c b/fs/lustre/obdclass/lu_tgt_pool.c
index 8f52fb4..17bae54 100644
--- a/fs/lustre/obdclass/lu_tgt_pool.c
+++ b/fs/lustre/obdclass/lu_tgt_pool.c
@@ -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++;
--
1.8.3.1
More information about the lustre-devel
mailing list