Whamcloud - gitweb
LU-17713 mdd: validate the length of mdd append_pool name
authorEmoly Liu <emoly@whamcloud.com>
Wed, 10 Apr 2024 09:18:03 +0000 (09:18 +0000)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 27 Apr 2024 22:30:02 +0000 (22:30 +0000)
Validate the length of mdd append_pool name (<= LOV_MAXPOOLNAME)
before saving it in function append_pool_store().
Also, sanity.sh test_27M is improved a little to verify this fix.

Lustre-change: https://review.whamcloud.com/54691
Lustre-commit: 509a7cf9778968f796794c3743e62bc6b2a71592

Signed-off-by: Emoly Liu <emoly@whamcloud.com>
Change-Id: Id7083fab60e9a18af4d8eedfa3d55f37544ba15d
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Zhenyu Xu <bobijam@hotmail.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54889
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/mdd/mdd_lproc.c
lustre/tests/sanity.sh

index d8b6d26..99efa98 100644 (file)
@@ -752,7 +752,7 @@ static ssize_t append_pool_store(struct kobject *kobj, struct attribute *attr,
        struct mdd_device *mdd = container_of(kobj, struct mdd_device,
                                              mdd_kobj);
 
-       if (!count || count > LOV_MAXPOOLNAME + 1)
+       if (!count || count > LOV_MAXPOOLNAME || buffer[0]  == '\n')
                return -EINVAL;
 
        /* clear previous value */
index 8105e68..9260256 100644 (file)
@@ -3100,6 +3100,12 @@ test_27M() {
        [[ "$pool" == "" ]] || error "expected append_pool == '', got '$pool'"
        stack_trap "do_nodes $mdts $LCTL set_param mdd.*.append_pool=none"
 
+       # Validate append_pool name length
+       (( $MDS1_VERSION >= $(version_code 2.14.0.144) )) &&
+               do_nodes $mdts $LCTL \
+                       set_param mdd.*.append_pool="LOV_MAXPOOLNAME*" &&
+                       error "Wrong pool name length should report error"
+
        local orig_count=$(do_facet mds1 $LCTL get_param -n mdd.$FSNAME-MDT0000.append_stripe_count)
        ((orig_count == 1)) || error "expected append_stripe_count == 1, got $orig_count"
        stack_trap "do_nodes $mdts $LCTL set_param mdd.*.append_stripe_count=1"