From c20d23cd92c5bc748a618e9ed96e6eddd794ab45 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: 61481796ac85e9ab2469b8d2f4cc75088c65d298 Change-Id: I4b3ee197f6e274abda06edf60b246f089fe28d10 Signed-off-by: Lei Feng Test-Parameters: trivial testlist=sanity-quota Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49611 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Stephane Thiell Reviewed-by: Oleg Drokin 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 4b674d8..6b98f4c 100644 --- a/lustre/include/lustre_quota.h +++ b/lustre/include/lustre_quota.h @@ -234,8 +234,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 f36601c..5b9ede2 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -5414,6 +5414,37 @@ test_81() { } run_test 81 "Race qmt_start_pool_recalc with qmt_pool_free" +test_82() +{ + (( $MDS1_VERSION >= $(version_code 2.14.55) )) || + skip "need MDS 2.14.55 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" + quota_fini() { do_nodes $(comma_list $(nodes_list)) \ -- 1.8.3.1