Whamcloud - gitweb
LU-16894 lod: fix stripe_count limit in lod_qos_set_pool 14/51314/5
authorEtienne AUJAMES <etienne.aujames@cea.fr>
Wed, 14 Jun 2023 08:02:01 +0000 (10:02 +0200)
committerOleg Drokin <green@whamcloud.com>
Wed, 28 Jun 2023 21:49:13 +0000 (21:49 +0000)
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.

Fixes: 06dd5a4 ("LU-15658 lod: ost list and pool name conflict")
Signed-off-by: Etienne AUJAMES <eaujames@ddn.com>
Change-Id: Ic47f9aadd8feea01367e526aaf0ea41a69ade9fa
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51314
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alexander Boyko <alexander.boyko@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lod/lod_qos.c

index c68a843..ff61d67 100644 (file)
@@ -2251,6 +2251,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
@@ -2259,43 +2260,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;
-
-                               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 (!pool)
+               goto out_setpool;
 
-               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);
+
 }
 
 /**