From: Etienne AUJAMES Date: Wed, 14 Jun 2023 08:02:01 +0000 (+0200) Subject: LU-16894 lod: fix stripe_count limit in lod_qos_set_pool X-Git-Tag: 2.15.5-RC1~43 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F27%2F51527%2F2;p=fs%2Flustre-release.git LU-16894 lod: fix stripe_count limit in lod_qos_set_pool For a conflicting pool name and stripe offset parameter, the MDS should not set the pool on the file layout in favor of the stripe offset (LU-15658). But lod_qos_set_pool() still limit the stripe_count to the number of OSTs in the specified pool. Let's fix this. Lustre-change: https://review.whamcloud.com/51314 Lustre-commit: d6df160877cda3ff1e0b3ce5c4df46fa17e1468a Fixes: 06dd5a4 ("LU-15658 lod: ost list and pool name conflict") Signed-off-by: Etienne AUJAMES Change-Id: Ic47f9aadd8feea01367e526aaf0ea41a69ade9fa Reviewed-by: Alexander Boyko Reviewed-by: Andreas Dilger Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51527 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index 0cb71d0..4d32877 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -2146,6 +2146,7 @@ static void lod_qos_set_pool(struct lod_object *lo, int pos, char *pool_name, struct lod_device *d = lu2lod_dev(lod2lu_obj(lo)->lo_dev); struct lod_layout_component *lod_comp; struct pool_desc *pool = NULL; + __u32 idx; int j, rc = 0; /* In the function below, .hs_keycmp resolves to @@ -2154,43 +2155,46 @@ static void lod_qos_set_pool(struct lod_object *lo, int pos, char *pool_name, if (pool_name) pool = lod_find_pool(d, pool_name); - if (pool) { - lod_comp = &lo->ldo_comp_entries[pos]; - if (lod_comp->llc_stripe_offset != LOV_OFFSET_DEFAULT) { - if (v1->lmm_magic == LOV_USER_MAGIC_SPECIFIC) { - struct lov_user_md_v3 *v3; + if (!pool) + goto out_setpool; - v3 = (struct lov_user_md_v3 *)v1; - for (j = 0; j < v3->lmm_stripe_count; j++) { - __u32 num; - - num = lod_comp->llc_ostlist.op_array[j]; - rc = lod_check_index_in_pool(num, pool); - if (rc) - break; - } - } else { - rc = lod_check_index_in_pool( - lod_comp->llc_stripe_offset, pool); - } - if (rc < 0) { - CDEBUG(D_LAYOUT, "%s: index %u is not in the " - "pool %s, dropping the pool\n", - lod2obd(d)->obd_name, - lod_comp->llc_stripe_offset, - pool_name); - pool_name = NULL; - } - } - - if (lod_comp->llc_stripe_count > pool_tgt_count(pool) && - !(lod_comp->llc_pattern & LOV_PATTERN_OVERSTRIPING)) - lod_comp->llc_stripe_count = pool_tgt_count(pool); + lod_comp = &lo->ldo_comp_entries[pos]; + if (lod_comp->llc_stripe_offset == LOV_OFFSET_DEFAULT) + goto out_checkcount; - lod_pool_putref(pool); - } + if (v1->lmm_magic == LOV_USER_MAGIC_SPECIFIC) { + struct lov_user_md_v3 *v3; + v3 = (struct lov_user_md_v3 *)v1; + for (j = 0; j < v3->lmm_stripe_count; j++) { + idx = lod_comp->llc_ostlist.op_array[j]; + rc = lod_check_index_in_pool(idx, pool); + if (rc) + break; + } + } else { + idx = lod_comp->llc_stripe_offset; + rc = lod_check_index_in_pool(idx, pool); + } + + if (!rc) + goto out_checkcount; + + CDEBUG(D_LAYOUT, + "%s: index %u is not in the pool %s, dropping the pool\n", + lod2obd(d)->obd_name, idx, pool_name); + pool_name = NULL; + goto out_putref; + +out_checkcount: + if (lod_comp->llc_stripe_count > pool_tgt_count(pool) && + !(lod_comp->llc_pattern & LOV_PATTERN_OVERSTRIPING)) + lod_comp->llc_stripe_count = pool_tgt_count(pool); +out_putref: + lod_pool_putref(pool); +out_setpool: lod_obj_set_pool(lo, pos, pool_name); + } /**