Whamcloud - gitweb
LU-14115 lod: fix to set inherit flag for stripe directroy 43/40543/3
authorWang Shilong <wshilong@ddn.com>
Thu, 5 Nov 2020 02:05:14 +0000 (10:05 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 19 Nov 2020 10:19:56 +0000 (10:19 +0000)
lod_xattr_set_lmv() is called to set attributes from parent
to all stripes of the directroy, however, flags are ignored
which will cause project inherit bits missed for stripes.

Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: I10a2de303b4b8430e560752cf0d66466c93616a4
Reviewed-on: https://review.whamcloud.com/40543
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lod/lod_object.c
lustre/tests/sanity-quota.sh

index 352db91..0c2c7e7 100644 (file)
@@ -3785,7 +3785,7 @@ static int lod_xattr_set_lmv(const struct lu_env *env, struct dt_object *dt,
        if (rc != 0)
                RETURN(rc);
 
-       attr->la_valid = LA_ATIME | LA_MTIME | LA_CTIME |
+       attr->la_valid = LA_ATIME | LA_MTIME | LA_CTIME | LA_FLAGS |
                         LA_MODE | LA_UID | LA_GID | LA_TYPE | LA_PROJID;
        dof->dof_type = DFT_DIR;
 
index ea32869..f999962 100755 (executable)
@@ -3526,6 +3526,41 @@ test_40c() {
 }
 run_test 40c "Remote child Dir inherit project quota properly"
 
+test_40d() {
+       [ "$MDSCOUNT" -lt "2" ] && skip_env "needs >= 2 MDTs"
+       is_project_quota_supported || skip "Project quota is not supported"
+
+       setup_quota_test || error "setup quota failed with $?"
+       local dir="$DIR/$tdir/dir"
+
+       mkdir -p $dir
+       $LFS setdirstripe -D -c 2 -i -1 $dir || error "setdirstripe failed"
+       change_project -sp $TSTPRJID $dir ||
+               error "change project on $dir failed"
+       for i in $(seq 5); do
+               mkdir -p $dir/d$i/d$i ||
+                       error "mkdir $dir/d$i/d$i failed"
+               local projid=$($LFS project -d $dir/d$i/d$i |
+                              awk '{print $1}')
+               [ "$projid" == "$TSTPRJID" ] ||
+                       error "projid id expected $TSTPRJID not $projid"
+               touch $dir/d$i/d$i/file
+               #verify inherit works file for stripe dir.
+               local projid=$($LFS project -d $dir/d$i/d$i/file | awk '{print $1}')
+               [ "$projid" == "$TSTPRJID" ] ||
+                       error "file under remote dir expected 1 not $projid"
+       done
+
+       # account should be 1 + (2 + 1) *10 + 1 * 5
+       USED=$(getquota -p $TSTPRJID global curinodes)
+       [ "$USED" == "36" ] ||
+               error "file count expected 36 got $USED"
+
+       rm -rf $dir
+       cleanup_quota_test
+}
+run_test 40d "Stripe Directory inherit project quota properly"
+
 test_50() {
        ! is_project_quota_supported &&
                skip "Project quota is not supported"