From dd8a4db4979464538184edf993daf7df0c89b4e7 Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Thu, 5 Nov 2020 10:05:14 +0800 Subject: [PATCH] LU-14115 lod: fix to set inherit flag for stripe directroy 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 Change-Id: I10a2de303b4b8430e560752cf0d66466c93616a4 Reviewed-on: https://review.whamcloud.com/40543 Tested-by: jenkins Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao Reviewed-by: Yingjin Qian Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/lod/lod_object.c | 2 +- lustre/tests/sanity-quota.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 352db91..0c2c7e7 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -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; diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index ea32869..f999962 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -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" -- 1.8.3.1