}
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_41() {
+ is_project_quota_supported ||
+ skip "Project quota is not supported"
+ setup_quota_test || error "setup quota failed with $?"
+ trap cleanup_quota_test EXIT
+ local dir="$DIR/$tdir/dir"
+ local blimit=102400
+ local ilimit=4096
+ local projid=$((testnum * 1000))
+
+ quota_init
+
+ # enable mdt/ost quota
+ set_mdt_qtype ugp || error "enable mdt quota failed"
+ set_ost_qtype ugp || error "enable ost quota failed"
+
+ test_mkdir -p $dir && change_project -sp $projid $dir
+ $LFS setquota -p $projid -b 0 -B ${blimit}K -i 0 -I $ilimit $dir ||
+ error "set project quota failed"
+
+ sync; sync_all_data
+ sleep_maxage
+
+ # check if df output works as expected
+ echo "== global statfs: $MOUNT =="
+ df -kP $MOUNT; df -iP $MOUNT; $LFS quota -p $projid $dir
+ echo
+ echo "== project statfs (prjid=$projid): $dir =="
+ df -kP $dir; df -iP $dir
+ local bused=$(getquota -p $projid global curspace)
+ local iused=$(getquota -p $projid global curinodes)
+ # note trailing space to match double printf from awk
+ local expected="$blimit $bused $ilimit $iused "
+
+ wait_update $HOSTNAME \
+ "{ df -kP $dir; df -iP $dir; } |
+ awk '/$FSNAME/ { printf \\\"%d %d \\\", \\\$2,\\\$3 }'" \
+ "$expected" ||
+ error "failed to get correct statfs for project quota"
+
+ cleanup_quota_test
+}
+run_test 41 "df should return projid-specific values"
+
test_50() {
! is_project_quota_supported &&
skip "Project quota is not supported"