Whamcloud - gitweb
LU-19058 llite: ll_statfs_project for projid 0 35/59435/4
authorSergey Cheremencev <scherementsev@ddn.com>
Thu, 22 May 2025 01:57:02 +0000 (04:57 +0300)
committerOleg Drokin <green@whamcloud.com>
Tue, 8 Jul 2025 03:56:16 +0000 (03:56 +0000)
df should take into account project quota limits for
squashed project id. Otherwhise it shows system wide
size.

Signed-off-by: Sergey Cheremencev <scherementsev@ddn.com>
Change-Id: Ieae5d8503829e2de859b60ed259bc0ee4d1274ca
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59435
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/llite/llite_lib.c
lustre/tests/sanity-quota.sh

index 68627d4..5771bfd 100644 (file)
@@ -2773,8 +2773,7 @@ int ll_statfs(struct dentry *de, struct kstatfs *sfs)
        sfs->f_fsid.val[0] = (__u32)fsid;
        sfs->f_fsid.val[1] = (__u32)(fsid >> 32);
        sfs->f_namelen = sbi->ll_namelen;
-       if (ll_i2info(de->d_inode)->lli_projid &&
-               test_bit(LL_SBI_STATFS_PROJECT, sbi->ll_flags) &&
+       if (test_bit(LL_SBI_STATFS_PROJECT, sbi->ll_flags) &&
            test_bit(LLIF_PROJECT_INHERIT, &ll_i2info(de->d_inode)->lli_flags))
                return ll_statfs_project(de->d_inode, sfs);
 
index 78704e2..498d651 100755 (executable)
@@ -7092,7 +7092,7 @@ test_94()
 }
 run_test 94 "lfs quota all respects nodemap offset"
 
-test_95() {
+test_95a() {
        local cmd="do_facet mgs $LCTL get_param -n "
        local squash=100
        local off=100000
@@ -7155,7 +7155,49 @@ test_95() {
        (( $($LFS quota -q -p 0 --bhardlimit $DIR) == 1027 )) ||
                error "Wrong proj limit for squashed root"
 }
-run_test 95 "Correct limits for squashed root"
+run_test 95a "Correct limits for squashed root"
+
+test_95b()
+{
+       local cmd="do_facet mgs $LCTL get_param -n "
+       local trusted
+       local projid
+       local act
+       local size
+
+       is_project_quota_supported || skip "project is not supported"
+       setup_quota_test || error "setup quota failed with $?"
+
+       trusted=$($cmd nodemap.default.trusted_nodemap)
+       do_facet mgs "$LCTL nodemap_modify --name default \
+               --property trusted --value 0"
+       stack_trap "do_facet mgs $LCTL nodemap_modify --name default \
+               --property trusted --value $trusted"
+
+       projid=$($cmd nodemap.default.squash_projid)
+       do_facet mgs "$LCTL nodemap_modify --name default \
+               --property squash_projid --value $TSTPRJID"
+       stack_trap "do_facet mgs $LCTL nodemap_modify --name default \
+               --property squash_projid --value $projid"
+
+       $LFS setquota -p $TSTPRJID -B10M $MOUNT ||
+               error "Set default quotas with squashed uid"
+
+       $LFS project -p 0 -sr $DIR
+       stack_trap "$LFS project -C -r $DIR"
+       $LFS project $DIR
+
+       act=$($cmd nodemap.active)
+       do_facet mgs $LCTL nodemap_activate 1
+       wait_nm_sync active
+       stack_trap "do_facet mgs $LCTL nodemap_activate $act; \
+                   wait_nm_sync active"
+
+       size=$(df -h --output=size $DIR | awk 'NR > 1 {print $1}')
+       echo "size :$size"
+       [[ $size == "10M" ]] || error "Wrong df size:$size, expect:10M"
+}
+run_test 95b "df respects squashed project id"
 
 quota_fini()
 {