From d412393b7e71f80d786929ace832465f8e6e3645 Mon Sep 17 00:00:00 2001 From: Lei Feng Date: Thu, 4 Nov 2021 19:41:06 +0800 Subject: [PATCH] LU-15193 quota: expand QUOTA_MAX_TRANSIDS to 12 In some rare cases 12 quota ids are needed. Usually (user, group) * (block, inode) * (inode, parent) = 8 qids are needed. But with project id, (user, group, project) * (block, inode) * (inode, parent) = 12 qids are needed. Lustre-change: https://review.whamcloud.com/45456 Lustre-commit: I4b3ee197f6e274abda06edf60b246f089fe28d10 Signed-off-by: Lei Feng Signed-off-by: Sergey Cheremencev Test-Parameters: trivial testlist=sanity-quota Change-Id: I26bcf97cbb79caee6f76dd076e1a03cd9ce3d9c5 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52410 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/include/lustre_quota.h | 5 +++-- lustre/tests/sanity-quota.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/lustre/include/lustre_quota.h b/lustre/include/lustre_quota.h index 605c999..3fdc688 100644 --- a/lustre/include/lustre_quota.h +++ b/lustre/include/lustre_quota.h @@ -230,8 +230,9 @@ struct lquota_id_info { * a single transaction for inode and block quota, which is chown transaction: * original uid and gid, new uid and gid. * - * This value might need to be revised when directory quota is added. */ -#define QUOTA_MAX_TRANSIDS 8 + * Given a parent dir and a sub dir, with different uid, gid and project id, + * need x x = 12 ids */ +#define QUOTA_MAX_TRANSIDS 12 /* all qids involved in a single transaction */ struct lquota_trans { diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 57e0777..075c43d 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -5681,6 +5681,37 @@ test_grace_with_default_quota() } +test_82() +{ + (( $MDS1_VERSION >= $(version_code 2.14.0.102) )) || + skip "need MDS 2.14.0.102 or later" + is_project_quota_supported || + skip "skip project quota unsupported" + + setup_quota_test || error "setup quota failed with $?" + stack_trap cleanup_quota_test + quota_init + + local parent_dir="$DIR/$tdir.parent" + local child_dir="$parent_dir/child" + + mkdir -p $child_dir + stack_trap "chown -R 0:0 $parent_dir" + + chown $TSTUSR:$TSTUSR $parent_dir || + error "failed to chown on $parent_dir" + chown $TSTUSR2:$TSTUSRS2 $child_dir || + error "failed to chown on $parent_dir" + + $LFS project -p 1000 $parent_dir || + error "failed to set project id on $parent_dir" + $LFS project -p 1001 $child_dir || + error "failed to set project id on $child_dir" + + rmdir $child_dir || error "cannot remove child dir, test failed" +} +run_test 82 "verify more than 8 qids for single operation" + test_83() { setup_quota_test || error "setup quota failed with $?" -- 1.8.3.1