Whamcloud - gitweb
LU-15193 quota: expand QUOTA_MAX_TRANSIDS to 12 56/45456/6
authorLei Feng <flei@whamcloud.com>
Thu, 4 Nov 2021 11:41:06 +0000 (19:41 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 11 Jun 2022 05:31:54 +0000 (05:31 +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.

Change-Id: I4b3ee197f6e274abda06edf60b246f089fe28d10
Signed-off-by: Lei Feng <flei@whamcloud.com>
Test-Parameters: trivial testlist=sanity-quota
Reviewed-on: https://review.whamcloud.com/45456
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Stephane Thiell <sthiell@stanford.edu>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_quota.h
lustre/tests/sanity-quota.sh

index 4b674d8..6b98f4c 100644 (file)
@@ -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 <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 f5eeb5c..4a534be 100755 (executable)
@@ -5412,6 +5412,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)) \