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.
Signed-off-by: Emoly Liu <emoly@whamcloud.com>
Change-Id: Id7083fab60e9a18af4d8eedfa3d55f37544ba15d
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54691
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Zhenyu Xu <bobijam@hotmail.com>
struct mdd_device *mdd = container_of(kobj, struct mdd_device,
mdd_kobj);
- if (!count || count > LOV_MAXPOOLNAME + 1 || buffer[0] == '\n')
+ if (!count || count > LOV_MAXPOOLNAME || buffer[0] == '\n')
return -EINVAL;
strscpy(mdd->mdd_append_pool, buffer, LOV_MAXPOOLNAME + 1);
[[ "$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.15.61) )) &&
+ 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"