Whamcloud - gitweb
LU-15193 quota: expand QUOTA_MAX_TRANSIDS to 12
authorLei Feng <flei@whamcloud.com>
Thu, 4 Nov 2021 11:41:06 +0000 (19:41 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 22 Sep 2023 23:51:41 +0000 (23:51 +0000)
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 <flei@whamcloud.com>
Signed-off-by: Sergey Cheremencev <scherementsev@ddn.com>
Test-Parameters: trivial testlist=sanity-quota
Change-Id: I26bcf97cbb79caee6f76dd076e1a03cd9ce3d9c5
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52410
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/include/lustre_quota.h
lustre/tests/sanity-quota.sh

index 605c999..3fdc688 100644 (file)
@@ -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 <parent,child> x <user,group,project> x <block,inode> = 12 ids */
+#define QUOTA_MAX_TRANSIDS    12
 
 /* all qids involved in a single transaction */
 struct lquota_trans {
index 57e0777..075c43d 100755 (executable)
@@ -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 $?"