3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
6 # Run test by setting NOSETUP=true when ltest has setup env for us
10 export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
13 # only accounting tests and test 22 are supported for the time being
14 ALWAYS_EXCEPT="0 1 2 3 4 5 6 7 8 9 10 11 12 13 15 17 18 19 20 21 23 24 27 30 36 $SANITY_QUOTA_EXCEPT"
15 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
17 [ "$ALWAYS_EXCEPT$EXCEPT" ] &&
18 echo "Skipping tests: `echo $ALWAYS_EXCEPT $EXCEPT`"
24 TSTID2=${TSTID2:-60001}
25 TSTUSR=${TSTUSR:-"quota_usr"}
26 TSTUSR2=${TSTUSR2:-"quota_2usr"}
31 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
32 . $LUSTRE/tests/test-framework.sh
34 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
36 DIRECTIO=${DIRECTIO:-$LUSTRE/tests/directio}
38 [ $MDSCOUNT -gt 1 ] && skip "CMD case" && exit 0
40 require_dsh_mds || exit 0
41 require_dsh_ost || exit 0
43 # XXX Once we drop the interoperability with old server (< 2.3.50), the
44 # sanity-quota-old.sh should be removed.
45 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
46 exec $LUSTRE/tests/sanity-quota-old.sh
49 # if e2fsprogs support quota feature?
50 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] && \
51 ! $DEBUGFS -c -R supported_features | grep -q 'quota'; then
52 skip "e2fsprogs doesn't support quota" && exit 0
55 [ "$SLOW" = "no" ] && EXCEPT_SLOW="9 18 21"
57 QUOTALOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
59 [ "$QUOTALOG" ] && rm -f $QUOTALOG || true
64 QUOTA_AUTO_OLD=$QUOTA_AUTO
67 check_and_setup_lustre
69 LOVNAME=`lctl get_param -n llite.*.lov.common_name | tail -n 1`
70 OSTCOUNT=`lctl get_param -n lov.$LOVNAME.numobd`
72 SHOW_QUOTA_USER="$LFS quota -v -u $TSTUSR $DIR"
73 SHOW_QUOTA_USERID="$LFS quota -v -u $TSTID $DIR"
74 SHOW_QUOTA_USER2="$LFS quota -v -u $TSTUSR2 $DIR"
75 SHOW_QUOTA_GROUP="$LFS quota -v -g $TSTUSR $DIR"
76 SHOW_QUOTA_GROUPID="$LFS quota -v -g $TSTID $DIR"
77 SHOW_QUOTA_GROUP2="$LFS quota -v -g $TSTUSR2 $DIR"
78 SHOW_QUOTA_INFO_USER="$LFS quota -t -u $DIR"
79 SHOW_QUOTA_INFO_GROUP="$LFS quota -t -g $DIR"
83 # Use OFD for all quota testing
85 USE_OFD_OLD="$USE_OFD"
86 LOAD_MODULES_REMOTE_OLD="$LOAD_MODULES_REMOTE"
88 export LOAD_MODULES_REMOTE="true"
94 local fail_val=${3:-0}
96 if [ $fail_node == "mds" ] || [ $fail_node == "mds_ost" ]; then
97 do_facet $SINGLEMDS "lctl set_param fail_val=$fail_val"
98 do_facet $SINGLEMDS "lctl set_param fail_loc=$fail_loc"
101 if [ $fail_node == "ost" ] || [ $fail_node == "mds_ost" ]; then
102 for num in `seq $OSTCOUNT`; do
103 do_facet ost$num "lctl set_param fail_val=$fail_val"
104 do_facet ost$num "lctl set_param fail_loc=$fail_loc"
109 RUNAS="runas -u $TSTID -g $TSTID"
110 RUNAS2="runas -u $TSTID2 -g $TSTID2"
111 FAIL_ON_ERROR=true check_runas_id $TSTID $TSTID $RUNAS
112 FAIL_ON_ERROR=true check_runas_id $TSTID2 $TSTID2 $RUNAS2
113 DD="dd if=/dev/zero bs=1M"
117 # clear quota limits for a user or a group
118 # usage: resetquota -u username
119 # resetquota -g groupname
122 [ "$#" != 2 ] && error "resetquota: wrong number of arguments: $#"
123 [ "$1" != "-u" -a "$1" != "-g" ] &&
124 error "resetquota: wrong specifier $1 passed"
126 $LFS setquota "$1" "$2" -b 0 -B 0 -i 0 -I 0 $MOUNT
127 # The usage should be 0 now, enforce quota to trigger quota
128 # release for each slave, sleep 3 seconds to wait for the release
129 # done, then we can make sure granted quota for each slave is 0.
130 $LFS setquota "$1" "$2" -b 0 -B 1 -i 0 -I 1 $MOUNT
132 $LFS setquota "$1" "$2" -b 0 -B 0 -i 0 -I 0 $MOUNT
139 if [ "$LOCAL_UG" == "a" -o "$LOCAL_UG" == "u" ]; then
140 $LFS quota -v -u $LOCAL_ID $DIR
141 log "Files for user ($LOCAL_ID):"
142 ($LFS find -user $LOCAL_ID $DIR | head -n 4 |
143 xargs stat 2>/dev/null)
146 if [ "$LOCAL_UG" == "a" -o "$LOCAL_UG" == "g" ]; then
147 $LFS quota -v -u $LOCAL_ID $DIR
148 log "Files for group ($LOCAL_ID):"
149 ($LFS find -group $LOCAL_ID $DIR | head -n 4 |
150 xargs stat 2>/dev/null)
166 # get quota for a user or a group
167 # usage: getquota -u|-g <username>|<groupname> global|<obd_uuid> \
168 # bhardlimit|bsoftlimit|bgrace|ihardlimit|isoftlimit|igrace
174 [ "$#" != 4 ] && error "getquota: wrong number of arguments: $#"
175 [ "$1" != "-u" -a "$1" != "-g" ] &&
176 error "getquota: wrong u/g specifier $1 passed"
189 *) error "unknown quota parameter $4";;
192 [ "$uuid" = "global" ] && uuid=$DIR
194 $LFS quota -v "$1" "$2" $DIR |
195 awk 'BEGIN { num='$spec' } { if ($1 == "'$uuid'") \
196 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
201 # usage: set_mdt_qtype ug|u|g|none
204 local varsvc=${SINGLEMDS}_svc
205 do_facet mgs $LCTL conf_param $FSNAME.quota.mdt=$qtype
206 if $(facet_up $SINGLEMDS); then
207 wait_update_facet $SINGLEMDS "$LCTL get_param -n \
208 osd-$FSTYPE.${!varsvc}.quota_slave.enabled" "$qtype" ||
215 # usage: set_ost_quota_type ug|u|g|none
219 local osts=$(get_facets OST)
220 do_facet mgs $LCTL conf_param $FSNAME.quota.ost=$qtype
221 # we have to make sure each OST received config changes
222 for ost in ${osts//,/ }; do
224 if $(facet_up $ost); then
225 wait_update_facet $ost "$LCTL get_param -n \
226 osd-$FSTYPE.${!varsvc}.quota_slave.enabled" \
233 wait_reintegration() {
236 local result="glb[1],slv[1],reint[0]"
239 if [ $ntype == "mdt" ]; then
240 varsvc=${SINGLEMDS}_svc
241 if $(facet_up $SINGLEMDS); then
242 wait_update_facet $SINGLEMDS "$LCTL get_param -n \
243 osd-$FSTYPE.${!varsvc}.quota_slave.info |
244 grep "$qtype" | awk '{ print \\\$3 }'" "$result" ||
248 local osts=$(get_facets OST)
249 for ost in ${osts//,/ }; do
251 if $(facet_up $ost); then
252 wait_update_facet $ost "$LCTL get_param -n \
253 osd-$FSTYPE.${!varsvc}.quota_slave.info |
254 grep "$qtype" | awk '{ print \\\$3 }'" \
255 "$result" || return 1
265 if [ $qtype == "u" ] || [ $qtype == "ug" ]; then
266 wait_reintegration "mdt" "user" || return 1
269 if [ $qtype == "g" ] || [ $qtype == "ug" ]; then
270 wait_reintegration "mdt" "group" || return 1
278 if [ $qtype == "u" ] || [ $qtype == "ug" ]; then
279 wait_reintegration "ost" "user" || return 1
282 if [ $qtype == "g" ] || [ $qtype == "ug" ]; then
283 wait_reintegration "ost" "group" || return 1
290 wait_delete_completed
291 echo "Creating test directory"
294 # always clear fail_loc in case of fail_loc isn't cleared
295 # properly when previous test failed
296 lustre_fail mds_ost 0
299 cleanup_quota_test() {
301 echo "Delete files..."
303 echo "Wait for unlink objects finished..."
304 wait_delete_completed
305 sync_all_data || true
314 $LFS quota -v -$ug $qid $DIR
316 if [ "$bf" == "a" -o "$bf" == "b" ]; then
317 usage=$(getquota -$ug $qid global curspace)
318 if [ -z $usage ]; then
319 quota_error $ug $qid \
320 "Query block quota failed ($ug:$qid)."
322 [ $usage -ne 0 ] && quota_log $ug $qid \
323 "Block quota isn't 0 ($ug:$qid:$usage)."
327 if [ "$bf" == "a" -o "$bf" == "f" ]; then
328 usage=$(getquota -$ug $qid global curinodes)
329 if [ -z $usage ]; then
330 quota_error $ug $qid \
331 "Query file quota failed ($ug:$qid)."
333 [ $usage -ne 0 ] && quota_log $ug $qid \
334 "File quota isn't 0 ($ug:$qid:$usage)."
341 do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=+quota"
345 test_quota_performance() {
346 local TESTFILE="$DIR/$tdir/$tfile-0"
347 local size=$1 # in MB
348 local stime=$(date +%s)
349 $RUNAS $DD of=$TESTFILE count=$size conv=fsync ||
350 quota_error u $TSTUSR "write failure"
351 local etime=$(date +%s)
352 delta=$((etime - stime))
353 if [ $delta -gt 0 ]; then
354 rate=$((size * 1024 / delta))
355 [ $rate -gt 1024 ] ||
356 error "SLOW IO for $TSTUSR (user): $rate KB/sec"
361 # test basic quota performance b=21696
364 trap cleanup_quota_test EXIT
367 [ "$SLOW" = "no" ] && MB=10
369 set_ost_qtype "none" || error "disable ost quota failed"
370 test_quota_performance $MB
372 set_ost_qtype "ug" || error "enable ost quota failed"
373 $LFS setquota -u $TSTUSR -b 0 -B 10G -i 0 -I 0 $DIR
374 test_quota_performance $MB
377 resetquota -u $TSTUSR
379 run_test 0 "Test basic quota performance"
381 # test block hardlimit
384 local TESTFILE="$DIR/$tdir/$tfile-0"
387 trap cleanup_quota_test EXIT
390 set_ost_qtype "ug" || "enable ost quota failed"
393 log "User quota (block hardlimit:$LIMIT MB)"
394 $LFS setquota -u $TSTUSR -b 0 -B ${LIMIT}M -i 0 -I 0 $DIR
396 # make sure the system is clean
397 local USED=$(getquota -u $TSTUSR global curspace)
398 [ $USED -ne 0 ] && error "Used space($USED) for user $TSTUSR isn't 0."
400 $LFS setstripe $TESTFILE -c 1
401 chown $TSTUSR.$TSTUSR $TESTFILE
404 $RUNAS $DD of=$TESTFILE count=$((LIMIT/2)) ||
405 quota_error u $TSTUSR "user write failure, but expect success"
406 log "Write out of block quota ..."
407 # this time maybe cache write, ignore it's failure
408 $RUNAS $DD of=$TESTFILE count=$((LIMIT/2)) seek=$((LIMIT/2)) || true
409 # flush cache, ensure noquota flag is set on client
411 $RUNAS $DD of=$TESTFILE count=1 seek=$LIMIT &&
412 quota_error u $TSTUSR "user write success, but expect EDQUOT"
415 wait_delete_completed
416 sync_all_data || true
417 USED=$(getquota -u $TSTUSR global curspace)
418 [ $USED -ne 0 ] && quota_error u $TSTUSR \
419 "user quota isn't released after deletion"
420 resetquota -u $TSTUSR
423 log "--------------------------------------"
424 log "Group quota (block hardlimit:$LIMIT MB)"
425 $LFS setquota -g $TSTUSR -b 0 -B ${LIMIT}M -i 0 -I 0 $DIR
427 TESTFILE="$DIR/$tdir/$tfile-1"
428 # make sure the system is clean
429 USED=$(getquota -g $TSTUSR global curspace)
430 [ $USED -ne 0 ] && error "Used space($USED) for group $TSTUSR isn't 0"
432 $LFS setstripe $TESTFILE -c 1
433 chown $TSTUSR.$TSTUSR $TESTFILE
436 $RUNAS $DD of=$TESTFILE count=$((LIMIT/2)) ||
437 quota_error g $TSTUSR "group write failure, but expect success"
438 log "Write out of block quota ..."
439 # this time maybe cache write, ignore it's failure
440 $RUNAS $DD of=$TESTFILE count=$((LIMIT/2)) seek=$((LIMIT/2)) || true
442 $RUNAS $DD of=$TESTFILE count=10 seek=$LIMIT &&
443 quota_error g $TSTUSR "group write success, but expect EDQUOT"
448 USED=$(getquota -g $TSTUSR global curspace)
449 [ $USED -ne 0 ] && quota_error g $TSTUSR \
450 "group quota isn't released after deletion"
452 resetquota -g $TSTUSR
454 run_test 1 "Block hard limit (normal use and out of quota)"
456 # test inode hardlimit
458 local LIMIT=$((1024 * 1024)) # 1M inodes
459 local TESTFILE="$DIR/$tdir/$tfile-0"
461 [ "$SLOW" = "no" ] && LIMIT=1024 # 1k inodes
464 trap cleanup_quota_test EXIT
467 set_mdt_qtype "ug" || "enable mdt quota failed"
470 log "User quota (inode hardlimit:$LIMIT files)"
471 $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I $LIMIT $DIR
473 # make sure the system is clean
474 local USED=$(getquota -u $TSTUSR global curinodes)
475 [ $USED -ne 0 ] && error "Used inodes($USED) for user $TSTUSR isn't 0."
477 log "Create $LIMIT files ..."
478 $RUNAS createmany -m ${TESTFILE} $LIMIT || \
479 quota_error u $TSTUSR "user create failure, but expect success"
480 log "Create out of file quota ..."
481 $RUNAS touch ${TESTFILE}_xxx && \
482 quota_error u $TSTUSR "user create success, but expect EDQUOT"
485 unlinkmany ${TESTFILE} $LIMIT
486 rm -f ${TESTFILE}_xxx
487 wait_delete_completed
489 USED=$(getquota -u $TSTUSR global curinodes)
490 [ $USED -ne 0 ] && quota_error u $TSTUSR \
491 "user quota isn't released after deletion"
492 resetquota -u $TSTUSR
495 log "--------------------------------------"
496 log "Group quota (inode hardlimit:$LIMIT files)"
497 $LFS setquota -g $TSTUSR -b 0 -B 0 -i 0 -I $LIMIT $DIR
499 TESTFILE=$DIR/$tdir/$tfile-1
500 # make sure the system is clean
501 USED=$(getquota -g $TSTUSR global curinodes)
502 [ $USED -ne 0 ] && error "Used inodes($USED) for group $TSTUSR isn't 0."
504 log "Create $LIMIT files ..."
505 $RUNAS createmany -m ${TESTFILE} $LIMIT ||
506 quota_error g $TSTUSR "group create failure, but expect success"
507 log "Create out of file quota ..."
508 $RUNAS touch ${TESTFILE}_xxx && \
509 quota_error g $TSTUSR "group create success, but expect EDQUOT"
512 unlinkmany ${TESTFILE} $LIMIT
513 rm -f ${TESTFILE}_xxx
514 wait_delete_completed
516 USED=$(getquota -g $TSTUSR global curinodes)
517 [ $USED -ne 0 ] && quota_error g $TSTUSR \
518 "user quota isn't released after deletion"
521 resetquota -g $TSTUSR
523 run_test 2 "File hard limit (normal use and out of quota)"
527 local TIMER=$(($2 * 3 / 2))
532 trap cleanup_quota_test EXIT
534 $LFS setstripe $TESTFILE -c 1 -i 0
535 chown $TSTUSR.$TSTUSR $TESTFILE
537 echo "Write up to soft limit"
538 $RUNAS $DD of=$TESTFILE count=$LIMIT ||
539 quota_error a $TSTUSR "write failure, but expect success"
540 OFFSET=$((LIMIT * 1024))
543 echo "Write to exceed soft limit"
544 $RUNAS dd if=/dev/zero of=$TESTFILE bs=1K count=10 seek=$OFFSET ||
545 quota_error a $TSTUSR "write failure, but expect success"
546 OFFSET=$((OFFSET + 1024)) # make sure we don't write to same block
551 $SHOW_QUOTA_INFO_USER
552 $SHOW_QUOTA_INFO_GROUP
554 echo "Write before timer goes off"
555 $RUNAS dd if=/dev/zero of=$TESTFILE bs=1K count=10 seek=$OFFSET ||
556 quota_error a $TSTUSR "write failure, but expect success"
557 OFFSET=$((OFFSET + 1024))
560 echo "Sleep $TIMER seconds ..."
565 $SHOW_QUOTA_INFO_USER
566 $SHOW_QUOTA_INFO_GROUP
568 echo "Write after timer goes off"
569 # maybe cache write, ignore.
570 $RUNAS dd if=/dev/zero of=$TESTFILE bs=1K count=10 seek=$OFFSET || true
571 OFFSET=$((OFFSET + 1024))
573 $RUNAS dd if=/dev/zero of=$TESTFILE bs=1K count=10 seek=$OFFSET &&
574 quota_error a $TSTUSR "write success, but expect EDQUOT"
578 $SHOW_QUOTA_INFO_USER
579 $SHOW_QUOTA_INFO_GROUP
581 echo "Unlink file to stop timer"
583 wait_delete_completed
584 sync_all_data || true
588 $SHOW_QUOTA_INFO_USER
589 $SHOW_QUOTA_INFO_GROUP
591 $LFS setstripe $TESTFILE -c 1 -i 0
592 chown $TSTUSR.$TSTUSR $TESTFILE
595 $RUNAS $DD of=$TESTFILE count=$LIMIT ||
596 quota_error a $TSTUSR "write failure, but expect success"
605 local TESTFILE=$DIR/$tdir/$tfile-0
607 set_ost_qtype "ug" || error "enable ost quota failed"
609 echo "User quota (soft limit:$LIMIT MB grace:$GRACE seconds)"
610 # make sure the system is clean
611 local USED=$(getquota -u $TSTUSR global curspace)
612 [ $USED -ne 0 ] && error "Used space($USED) for user $TSTUSR isn't 0."
614 $LFS setquota -t -u --block-grace $GRACE --inode-grace $MAX_IQ_TIME $DIR
615 $LFS setquota -u $TSTUSR -b ${LIMIT}M -B 0 -i 0 -I 0 $DIR
617 test_block_soft $TESTFILE $GRACE $LIMIT
618 resetquota -u $TSTUSR
620 echo "Group quota (soft limit:$LIMIT MB grace:$GRACE seconds)"
621 TESTFILE=$DIR/$tdir/$tfile-1
622 # make sure the system is clean
623 USED=$(getquota -g $TSTUSR global curspace)
624 [ $USED -ne 0 ] && error "Used space($USED) for group $TSTUSR isn't 0."
626 $LFS setquota -t -g --block-grace $GRACE --inode-grace $MAX_IQ_TIME $DIR
627 $LFS setquota -g $TSTUSR -b ${LIMIT}M -B 0 -i 0 -I 0 $DIR
629 test_block_soft $TESTFILE $GRACE $LIMIT
630 resetquota -g $TSTUSR
633 $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace \
635 $LFS setquota -t -g --block-grace $MAX_DQ_TIME --inode-grace \
638 run_test 3 "Block soft limit (start timer, timer goes off, stop timer)"
643 local TIMER=$(($3 * 3 / 2))
646 trap cleanup_quota_test EXIT
648 echo "Create files to exceed soft limit"
649 $RUNAS createmany -m ${TESTFILE}_ $((LIMIT + 1)) ||
650 quota_error a $TSTUSR "create failure, but expect success"
653 echo "Create file before timer goes off"
654 $RUNAS touch ${TESTFILE}_before ||
655 quota_error a $TSTUSR "failed create before timer expired," \
659 echo "Sleep $TIMER seconds ..."
664 $SHOW_QUOTA_INFO_USER
665 $SHOW_QUOTA_INFO_GROUP
667 echo "Create file after timer goes off"
668 # There is a window that space is accounted in the quota usage but
669 # hasn't been decreased from the pending write, if we acquire quota
670 # in this window, we'll acquire more than we needed.
671 $RUNAS touch ${TESTFILE}_after_1 ${TESTFILE}_after_2 || true
673 $RUNAS touch ${TESTFILE}_after_3 &&
674 quota_error a $TSTUSR "create after timer expired," \
680 $SHOW_QUOTA_INFO_USER
681 $SHOW_QUOTA_INFO_GROUP
683 echo "Unlink files to stop timer"
684 find $(dirname $TESTFILE) -name "$(basename ${TESTFILE})*" | xargs rm -f
685 wait_delete_completed
688 $RUNAS touch ${TESTFILE}_xxx ||
689 quota_error a $TSTUSR "touch after timer stop failure," \
699 local LIMIT=10 # inodes
700 local TESTFILE=$DIR/$tdir/$tfile-0
703 set_mdt_qtype "ug" || error "enable mdt quota failed"
705 echo "User quota (soft limit:$LIMIT files grace:$GRACE seconds)"
706 # make sure the system is clean
707 local USED=$(getquota -u $TSTUSR global curinodes)
708 [ $USED -ne 0 ] && error "Used space($USED) for user $TSTUSR isn't 0."
710 $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace $GRACE $DIR
711 $LFS setquota -u $TSTUSR -b 0 -B 0 -i $LIMIT -I 0 $DIR
713 test_file_soft $TESTFILE $LIMIT $GRACE
714 resetquota -u $TSTUSR
716 echo "Group quota (soft limit:$LIMIT files grace:$GRACE seconds)"
717 # make sure the system is clean
718 USED=$(getquota -g $TSTUSR global curinodes)
719 [ $USED -ne 0 ] && error "Used space($USED) for group $TSTUSR isn't 0."
721 $LFS setquota -t -g --block-grace $MAX_DQ_TIME --inode-grace $GRACE $DIR
722 $LFS setquota -g $TSTUSR -b 0 -B 0 -i $LIMIT -I 0 $DIR
723 TESTFILE=$DIR/$tdir/$tfile-1
725 test_file_soft $TESTFILE $LIMIT $GRACE
726 resetquota -g $TSTUSR
729 $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace \
731 $LFS setquota -t -g --block-grace $MAX_DQ_TIME --inode-grace \
734 run_test 4a "File soft limit (start timer, timer goes off, stop timer)"
738 local GR_STR2="1000s"
740 local GR_STR4="1w2d3h4m5s"
742 local GR_STR6="1111111111111111"
744 wait_delete_completed
746 # test of valid grace strings handling
747 echo "Valid grace strings test"
748 $LFS setquota -t -u --block-grace $GR_STR1 --inode-grace $GR_STR2 $DIR
749 $LFS quota -u -t $DIR | grep "Block grace time: $GR_STR1"
750 $LFS setquota -t -g --block-grace $GR_STR3 --inode-grace $GR_STR4 $DIR
751 $LFS quota -g -t $DIR | grep "Inode grace time: $GR_STR4"
753 # test of invalid grace strings handling
754 echo " Invalid grace strings test"
755 ! $LFS setquota -t -u --block-grace $GR_STR4 --inode-grace $GR_STR5 $DIR
756 ! $LFS setquota -t -g --block-grace $GR_STR4 --inode-grace $GR_STR6 $DIR
759 $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace \
761 $LFS setquota -t -g --block-grace $MAX_DQ_TIME --inode-grace \
764 run_test 4b "Grace time strings handling"
766 # chown & chgrp (chown & chgrp successfully even out of block/file quota)
768 local BLIMIT=10 # 10M
769 local ILIMIT=10 # 10 inodes
772 trap cleanup_quota_test EXIT
774 set_mdt_qtype "ug" || error "enable mdt quota failed"
775 set_ost_qtype "ug" || error "enable ost quota failed"
777 echo "Set quota limit (0 ${BLIMIT}M 0 $ILIMIT) for $TSTUSR.$TSTUSR"
778 $LFS setquota -u $TSTUSR -b 0 -B ${BLIMIT}M -i 0 -I $ILIMIT $DIR
779 $LFS setquota -g $TSTUSR -b 0 -B ${BLIMIT}M -i 0 -I $ILIMIT $DIR
781 # make sure the system is clean
782 local USED=$(getquota -u $TSTUSR global curinodes)
783 [ $USED -ne 0 ] && error "Used inode($USED) for user $TSTUSR isn't 0."
784 USED=$(getquota -g $TSTUSR global curinodes)
785 [ $USED -ne 0 ] && error "Used inode($USED) for group $TSTUSR isn't 0."
786 USED=$(getquota -u $TSTUSR global curspace)
787 [ $USED -ne 0 ] && error "Used block($USED) for user $TSTUSR isn't 0."
788 USED=$(getquota -g $TSTUSR global curspace)
789 [ $USED -ne 0 ] && error "Used block($USED) for group $TSTUSR isn't 0."
791 echo "Create more than $ILIMIT files and more than $BLIMIT MB ..."
792 createmany -m $DIR/$tdir/$tfile-0_ $((ILIMIT + 1)) ||
793 error "create failure, expect success"
794 $DD of=$DIR/$tdir/$tfile-0_1 count=$((BLIMIT+1)) ||
795 error "write failure, expect success"
797 echo "Chown files to $TSTUSR.$TSTUSR ..."
798 for i in `seq 0 $ILIMIT`; do
799 chown $TSTUSR.$TSTUSR $DIR/$tdir/$tfile-0_$i ||
800 quota_error a $TSTUSR "chown failure, expect success"
804 unlinkmany $DIR/$tdir/$tfile-0_ $((ILIMIT + 1))
807 resetquota -u $TSTUSR
808 resetquota -g $TSTUSR
810 run_test 5 "Chown & chgrp successfully even out of block/file quota"
812 # test dropping acquire request on master
815 trap cleanup_quota_test EXIT
817 # make sure the system is clean
818 local USED=$(getquota -u $TSTUSR global curspace)
819 [ $USED -ne 0 ] && error "Used space($USED) for user $TSTUSR isn't 0."
821 # make sure no granted quota on ost
822 set_ost_qtype "ug" || error "enable ost quota failed"
823 resetquota -u $TSTUSR
825 # create file for $TSTUSR
826 local TESTFILE=$DIR/$tdir/$tfile-$TSTUSR
827 $LFS setstripe $TESTFILE -c 1 -i 0
828 chown $TSTUSR.$TSTUSR $TESTFILE
830 # create file for $TSTUSR2
831 local TESTFILE2=$DIR/$tdir/$tfile-$TSTUSR2
832 $LFS setstripe $TESTFILE2 -c 1 -i 0
833 chown $TSTUSR2.$TSTUSR2 $TESTFILE2
835 # cache per-ID lock for $TSTUSR on slave
836 $LFS setquota -u $TSTUSR -b 0 -B 2M -i 0 -I 0 $DIR
837 $RUNAS $DD of=$TESTFILE count=1 ||
838 error "write $TESTFILE failure, expect success"
839 $RUNAS2 $DD of=$TESTFILE2 count=1 ||
840 error "write $TESTFILE2 failure, expect success"
842 sync_all_data || true
844 # set a small timeout value, to make the quota RPC timedout before
845 # the watchdog triggered.
847 if at_is_enabled; then
848 timeout=$(at_max_get ost)
851 timeout=$(do_facet ost1 $LCTL get_param -n timeout)
852 do_facet ost1 $LCTL set_param timeout=20
855 #define QUOTA_DQACQ 601
856 #define OBD_FAIL_PTLRPC_DROP_REQ_OPC 0x513
857 lustre_fail mds 0x513 601
859 # write to un-enforced ID ($TSTUSR2) should succeed
860 $RUNAS2 $DD of=$TESTFILE2 count=1 seek=1 oflag=sync conv=notrunc ||
861 error "write failure, expect success"
863 # write to enforced ID ($TSTUSR) in background, exceeding limit
864 # to make sure DQACQ is sent
865 $RUNAS $DD of=$TESTFILE count=2 seek=1 oflag=sync conv=notrunc &
868 echo "Sleep for $timeout"
871 # write should be blocked and never finished
872 if ! ps -p $DDPID > /dev/null 2>&1; then
874 error "write finished incorrectly!"
877 if at_is_enabled; then
878 at_max_set $timeout ost
880 do_facet ost1 $LCTL set_param timeout=$timeout
885 # no watchdog is triggered
886 do_facet ost1 dmesg > $TMP/lustre-log-${TESTNAME}.log
887 watchdog=$(awk '/sanity-quota test 6/ {start = 1;}
888 /Service thread pid/ && /was inactive/ {
892 }' $TMP/lustre-log-${TESTNAME}.log)
893 [ -z "$watchdog" ] || error "$watchdog"
895 rm -f $TMP/lustre-log-${TESTNAME}.log
897 # write should continue & succeed
900 if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi
901 if [ $count -ge 120 ]; then
902 quota_error u $TSTUSR "dd not finished in $count secs"
905 [ $((count % 10)) -eq 0 ] && echo "Waiting $count secs"
910 resetquota -u $TSTUSR
912 run_test 6 "Test dropping acquire request on master"
914 # quota reintegration (global index)
916 local TESTFILE=$DIR/$tdir/$tfile
919 [ "$SLOW" = "no" ] && LIMIT=5
922 trap cleanup_quota_test EXIT
924 # make sure the system is clean
925 local USED=$(getquota -u $TSTUSR global curspace)
926 [ $USED -ne 0 ] && error "Used space($USED) for user $TSTUSR isn't 0."
928 # make sure no granted quota on ost1
929 set_ost_qtype "ug" || error "enable ost quota failed"
930 resetquota -u $TSTUSR
931 set_ost_qtype "none" || error "disable ost quota failed"
933 local OSTUUID=$(ostuuid_from_index 0)
934 USED=$(getquota -u $TSTUSR $OSTUUID bhardlimit)
935 [ $USED -ne 0 ] && error "limit($USED) on $OSTUUID for user" \
939 $LFS setstripe $TESTFILE -c 1 -i 0
940 chown $TSTUSR.$TSTUSR $TESTFILE
945 echo "Enable quota & set quota limit for $TSTUSR"
946 set_ost_qtype "ug" || error "enable ost quota failed"
947 $LFS setquota -u $TSTUSR -b 0 -B ${LIMIT}M -i 0 -I 0 $DIR
950 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
952 wait_ost_reint "ug" || error "reintegration failed"
954 # hardlimit should have been fetched by slave during global
955 # reintegration, write will exceed quota
956 $RUNAS $DD of=$TESTFILE count=$((LIMIT + 1)) oflag=sync &&
957 quota_error u $TSTUSR "write success, but expect EDQUOT"
960 resetquota -u $TSTUSR
962 run_test 7a "Quota reintegration (global index)"
964 # quota reintegration (slave index)
967 local TESTFILE=$DIR/$tdir/$tfile
970 trap cleanup_quota_test EXIT
972 # make sure the system is clean
973 local USED=$(getquota -u $TSTUSR global curspace)
974 [ $USED -ne 0 ] && error "Used space($USED) for user $TSTUSR isn't 0."
976 # make sure no granted quota on ost1
977 set_ost_qtype "ug" || error "enable ost quota failed"
978 resetquota -u $TSTUSR
979 set_ost_qtype "none" || error "disable ost quota failed"
981 local OSTUUID=$(ostuuid_from_index 0)
982 USED=$(getquota -u $TSTUSR $OSTUUID bhardlimit)
983 [ $USED -ne 0 ] && error "limit($USED) on $OSTUUID for user" \
987 $LFS setstripe $TESTFILE -c 1 -i 0
988 chown $TSTUSR.$TSTUSR $TESTFILE
990 # consume some space to make sure the granted space will not
991 # be released during reconciliation
992 $RUNAS $DD of=$TESTFILE count=1 oflag=sync ||
993 error "consume space failure, expect success"
995 # define OBD_FAIL_QUOTA_EDQUOT 0xa02
996 lustre_fail mds 0xa02
998 set_ost_qtype "ug" || error "enable ost quota failed"
999 $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR
1001 # ignore the write error
1002 $RUNAS $DD of=$TESTFILE count=1 seek=1 oflag=sync conv=notrunc
1004 local old_used=$(getquota -u $TSTUSR $OSTUUID bhardlimit)
1008 echo "Restart ost to trigger reintegration..."
1010 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
1012 wait_ost_reint "ug" || error "reintegration failed"
1014 USED=$(getquota -u $TSTUSR $OSTUUID bhardlimit)
1015 [ $USED -gt $old_used ] || error "limit on $OSTUUID $USED <= $old_used"
1018 resetquota -u $TSTUSR
1021 run_test 7b "Quota reintegration (slave index)"
1023 # quota reintegration (restart mds during reintegration)
1025 local LIMIT=20 # 20M
1026 local TESTFILE=$DIR/$tdir/$tfile
1028 [ "$SLOW" = "no" ] && LIMIT=5
1031 trap cleanup_quota_test EXIT
1033 # make sure the system is clean
1034 local USED=$(getquota -u $TSTUSR global curspace)
1035 [ $USED -ne 0 ] && error "Used space($USED) for user $TSTUSR isn't 0."
1037 set_ost_qtype "none" || error "disable ost quota failed"
1038 $LFS setquota -u $TSTUSR -b 0 -B ${LIMIT}M -i 0 -I 0 $DIR
1040 # define OBD_FAIL_QUOTA_DELAY_REINT 0xa03
1041 lustre_fail ost 0xa03
1043 # enable ost quota to trigger reintegration
1044 set_ost_qtype "ug" || error "enable ost quota failed"
1052 start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
1054 wait_ost_reint "ug" || error "reintegration failed"
1056 # hardlimit should have been fetched by slave during global
1057 # reintegration, write will exceed quota
1058 $RUNAS $DD of=$TESTFILE count=$((LIMIT + 1)) oflag=sync &&
1059 quota_error u $TSTUSR "write success, but expect EDQUOT"
1062 resetquota -u $TSTUSR
1064 run_test 7c "Quota reintegration (restart mds during reintegration)"
1066 # run dbench with quota enabled
1068 local BLK_LIMIT="100g" #100G
1069 local FILE_LIMIT=1000000
1072 trap cleanup_quota_test EXIT
1074 set_mdt_qtype "ug" || error "enable mdt quota failed"
1075 set_ost_qtype "ug" || error "enable ost quota failed"
1077 echo "Set enough high limit for user: $TSTUSR"
1078 $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $DIR
1079 echo "Set enough high limit for group: $TSTUSR"
1080 $LFS setquota -g $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $DIR
1083 [ "$SLOW" = "no" ] && duration=" -t 120"
1084 $RUNAS bash rundbench -D $DIR/$tdir 3 $duration ||
1085 quota_error a $TSTUSR "dbench failed!"
1088 resetquota -u $TSTUSR
1089 resetquota -g $TSTUSR
1091 run_test 8 "Run dbench with quota enabled"
1093 # this check is just for test_9
1094 OST0_MIN=4900000 #4.67G
1096 check_whether_skip () {
1097 local OST0_SIZE=$($LFS df $DIR | awk '/\[OST:0\]/ {print $4}')
1098 log "OST0_SIZE: $OST0_SIZE required: $OST0_MIN"
1099 if [ $OST0_SIZE -lt $OST0_MIN ]; then
1100 echo "WARN: OST0 has less than $OST0_MIN free, skip this test."
1107 # run for fixing bug10707, it needs a big room. test for 64bit
1109 local filesize=$((1024 * 1024 * 1024 * 9 / 2)) # 4.5G
1111 check_whether_skip && return 0
1114 trap cleanup_quota_test EXIT
1116 set_ost_qtype "ug" || error "enable ost quota failed"
1118 local TESTFILE="$DIR/$tdir/$tfile-0"
1119 local BLK_LIMIT=100G #100G
1120 local FILE_LIMIT=1000000
1122 echo "Set block limit $BLK_LIMIT bytes to $TSTUSR.$TSTUSR"
1124 log "Set enough high limit(block:$BLK_LIMIT; file: $FILE_LIMIT)" \
1126 $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $DIR
1128 log "Set enough high limit(block:$BLK_LIMIT; file: $FILE_LIMIT)" \
1129 "for group: $TSTUSR"
1130 $LFS setquota -g $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $DIR
1132 quota_show_check a u $TSTUSR
1133 quota_show_check a g $TSTUSR
1135 echo "Create test file"
1136 $LFS setstripe $TESTFILE -c 1 -i 0
1137 chown $TSTUSR.$TSTUSR $TESTFILE
1139 log "Write the big file of 4.5G ..."
1140 $RUNAS $DD of=$TESTFILE count=$filesize ||
1141 quota_error a $TSTUSR "write 4.5G file failure, expect success"
1147 resetquota -u $TSTUSR
1148 resetquota -g $TSTUSR
1153 run_test 9 "Block limit larger than 4GB (b10707)"
1156 local TESTFILE=$DIR/$tdir/$tfile
1159 trap cleanup_quota_test EXIT
1161 # set limit to root user should fail
1162 $LFS setquota -u root -b 100G -B 500G -i 1K -I 1M $DIR &&
1163 error "set limit for root user successfully, expect failure"
1164 $LFS setquota -g root -b 1T -B 10T -i 5K -I 100M $DIR &&
1165 error "set limit for root group successfully, expect failure"
1167 # root user can overrun quota
1168 set_ost_qtype "ug" || "enable ost quota failed"
1170 $LFS setquota -u $TSTUSR -b 0 -B 2M -i 0 -I 0 $DIR
1171 quota_show_check b u $TSTUSR
1173 $LFS setstripe $TESTFILE -c 1
1174 chown $TSTUSR.$TSTUSR $TESTFILE
1176 runas -u 0 -g 0 $DD of=$TESTFILE count=3 oflag=sync ||
1177 error "write failure, expect success"
1180 resetquota -u $TSTUSR
1182 run_test 10 "Test quota for root user"
1185 local TESTFILE=$DIR/$tdir/$tfile
1187 trap cleanup_quota_test EXIT
1189 set_mdt_qtype "ug" || "enable mdt quota failed"
1190 $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 1 $DIR
1195 chown $TSTUSR.$TSTUSR "$TESTFILE"-0
1196 chown $TSTUSR.$TSTUSR "$TESTFILE"-1
1199 local USED=$(getquota -u $TSTUSR global curinodes)
1200 [ $USED -ge 2 ] || error "Used inodes($USED) is less than 2"
1203 resetquota -u $TSTUSR
1205 run_test 11 "Chown/chgrp ignores quota"
1208 [ "$OSTCOUNT" -lt "2" ] && skip "skipping rebalancing test" && return
1210 local blimit=22 # 22M
1211 local blk_cnt=$((blimit - 5))
1212 local TESTFILE0="$DIR/$tdir/$tfile"-0
1213 local TESTFILE1="$DIR/$tdir/$tfile"-1
1216 trap cleanup_quota_test EXIT
1218 set_ost_qtype "u" || "enable ost quota failed"
1219 quota_show_check b u $TSTUSR
1221 $LFS setquota -u $TSTUSR -b 0 -B "$blimit"M -i 0 -I 0 $DIR
1223 $LFS setstripe $TESTFILE0 -c 1 -i 0
1224 $LFS setstripe $TESTFILE1 -c 1 -i 1
1225 chown $TSTUSR.$TSTUSR $TESTFILE0
1226 chown $TSTUSR.$TSTUSR $TESTFILE1
1228 echo "Write to ost0..."
1229 $RUNAS $DD of=$TESTFILE0 count=$blk_cnt oflag=sync ||
1230 quota_error a $TSTUSR "dd failed"
1232 echo "Write to ost1..."
1233 $RUNAS $DD of=$TESTFILE1 count=$blk_cnt oflag=sync &&
1234 quota_error a $TSTUSR "dd succeed, expect EDQUOT"
1236 echo "Free space from ost0..."
1238 wait_delete_completed
1239 sync_all_data || true
1241 echo "Write to ost1 after space freed from ost0..."
1242 $RUNAS $DD of=$TESTFILE1 count=$blk_cnt oflag=sync ||
1243 quota_error a $TSTUSR "rebalancing failed"
1246 resetquota -u $TSTUSR
1248 run_test 12 "Block quota rebalancing"
1251 local TESTFILE=$DIR/$tdir/$tfile
1252 # the name of osp on ost1 name is MDT0000-osp-OST0000
1253 local procf="ldlm.namespaces.*MDT0000-osp-OST0000.lru_size"
1256 trap cleanup_quota_test EXIT
1258 set_ost_qtype "u" || "enable ost quota failed"
1259 quota_show_check b u $TSTUSR
1261 $LFS setquota -u $TSTUSR -b 0 -B 10M -i 0 -I 0 $DIR
1262 $LFS setstripe $TESTFILE -c 1 -i 0
1263 chown $TSTUSR.$TSTUSR $TESTFILE
1265 # clear the locks in cache first
1266 do_facet ost1 $LCTL set_param -n $procf=clear
1267 local nlock=$(do_facet ost1 $LCTL get_param -n $procf)
1268 [ $nlock -eq 0 ] || error "$nlock cached locks"
1270 # write to acquire the per-ID lock
1271 $RUNAS $DD of=$TESTFILE count=1 oflag=sync ||
1272 quota_error a $TSTUSR "dd failed"
1274 nlock=$(do_facet ost1 $LCTL get_param -n $procf)
1275 [ $nlock -eq 1 ] || error "lock count($nlock) isn't 1"
1277 # clear quota doesn't trigger per-ID lock cancellation
1278 resetquota -u $TSTUSR
1279 nlock=$(do_facet ost1 $LCTL get_param -n $procf)
1280 [ $nlock -eq 1 ] || error "per-ID lock is lost on quota clear"
1282 # clear the per-ID lock
1283 do_facet ost1 $LCTL set_param -n $procf=clear
1284 nlock=$(do_facet ost1 $LCTL get_param -n $procf)
1285 [ $nlock -eq 0 ] || error "per-ID lock isn't cleared"
1287 # spare quota should be released
1288 local OSTUUID=$(ostuuid_from_index 0)
1289 local limit=$(getquota -u $TSTUSR $OSTUUID bhardlimit)
1290 local space=$(getquota -u $TSTUSR $OSTUUID curspace)
1291 [ $limit -le $space ] ||
1292 error "spare quota isn't released, limit:$limit, space:$space"
1296 run_test 13 "Cancel per-ID lock in the LRU list"
1299 local LIMIT=$((24 * 1024 * 1024 * 1024 * 1024)) # 24 TB
1301 wait_delete_completed
1302 sync_all_data || true
1305 $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR
1306 local TOTAL_LIMIT=$(getquota -u $TSTUSR global bhardlimit)
1307 [ $TOTAL_LIMIT -eq $LIMIT ] ||
1308 error "(user) limit:$TOTAL_LIMIT, expect:$LIMIT, failed!"
1309 resetquota -u $TSTUSR
1312 $LFS setquota -g $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR
1313 TOTAL_LIMIT=$(getquota -g $TSTUSR global bhardlimit)
1314 [ $TOTAL_LIMIT -eq $LIMIT ] ||
1315 error "(group) limits:$TOTAL_LIMIT, expect:$LIMIT, failed!"
1316 resetquota -g $TSTUSR
1318 run_test 15 "Set over 4T block quota"
1322 local BLKS=1 # 1M less than limit
1323 local TESTFILE=$DIR/$tdir/$tfile
1326 trap cleanup_quota_test EXIT
1328 # make sure the system is clean
1329 local USED=$(getquota -u $TSTUSR global curspace)
1330 [ $USED -ne 0 ] && error "Used space($USED) for user $TSTUSR isn't 0."
1332 set_ost_qtype "ug" || error "enable ost quota failed"
1333 # make sure no granted quota on ost
1334 resetquota -u $TSTUSR
1335 $LFS setquota -u $TSTUSR -b 0 -B 10M -i 0 -I 0 $DIR
1337 quota_show_check b u $TSTUSR
1339 #define OBD_FAIL_QUOTA_RECOVERABLE_ERR 0xa04
1340 lustre_fail mds 0xa04 $err_code
1342 # write in background
1343 $RUNAS $DD of=$TESTFILE count=$BLKS oflag=direct &
1347 # write should be blocked and never finished
1348 if ! ps -p $DDPID > /dev/null 2>&1; then
1350 quota_error u $TSTUSR "write finished incorrectly!"
1358 if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi
1360 if [ $count -gt $timeout ]; then
1361 quota_error u $TSTUSR "dd is not finished!"
1366 sync; sync_all_data || true
1368 USED=$(getquota -u $TSTUSR global curspace)
1369 [ $USED -ge $(($BLKS * 1024)) ] || quota_error u $TSTUSR \
1370 "Used space(${USED}K) is less than ${BLKS}M"
1373 resetquota -u $TSTUSR
1376 # DQACQ return recoverable error
1378 echo "DQACQ return -ENOLCK"
1380 test_17sub 37 || error "Handle -ENOLCK failed"
1382 echo "DQACQ return -EAGAIN"
1384 test_17sub 11 || error "Handle -EAGAIN failed"
1386 echo "DQACQ return -ETIMEDOUT"
1387 #define ETIMEDOUT 110
1388 test_17sub 110 || error "Handle -ETIMEDOUT failed"
1390 echo "DQACQ return -ENOTCONN"
1391 #define ENOTCONN 107
1392 test_17sub 107 || error "Handle -ENOTCONN failed"
1395 run_test 17 "DQACQ return recoverable error"
1399 local blimit="200m" # 200M
1400 local TESTFILE="$DIR/$tdir/$tfile"
1403 trap cleanup_quota_test EXIT
1405 set_ost_qtype "u" || error "enable ost quota failed"
1406 log "User quota (limit: $blimit)"
1407 $LFS setquota -u $TSTUSR -b 0 -B $blimit -i 0 -I 0 $MOUNT
1408 quota_show_check b u $TSTUSR
1410 $LFS setstripe $TESTFILE -i 0 -c 1
1411 chown $TSTUSR.$TSTUSR $TESTFILE
1413 local timeout=$(sysctl -n lustre.timeout)
1415 if [ $io_type = "directio" ]; then
1416 log "Write 100M (directio) ..."
1417 $RUNAS $DD of=$TESTFILE count=100 oflag=direct &
1419 log "Write 100M (buffered) ..."
1420 $RUNAS $DD of=$TESTFILE count=100 &
1424 replay_barrier $SINGLEMDS
1425 log "Fail mds for $((2 * timeout)) seconds"
1426 fail $SINGLEMDS $((2 * timeout))
1429 if at_is_enabled; then
1430 timeout=$(at_max_get mds)
1432 timeout=$(lctl get_param -n timeout)
1436 if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi
1437 if [ $((++count % (2 * timeout) )) -eq 0 ]; then
1438 log "it took $count second"
1443 log "(dd_pid=$DDPID, time=$count, timeout=$timeout)"
1445 cancel_lru_locks mdc
1446 cancel_lru_locks osc
1449 local testfile_size=$(stat -c %s $TESTFILE)
1450 if [ $testfile_size -ne $((BLK_SZ * 1024 * 100)) ] ; then
1451 quota_error u $TSTUSR "expect $((BLK_SZ * 1024 * 100)),"
1452 "got ${testfile_size}. Verifying file failed!"
1455 resetquota -u $TSTUSR
1458 # test when mds does failover, the ost still could work well
1459 # this test shouldn't trigger watchdog b=14840
1462 test_18_sub directio
1464 # check if watchdog is triggered
1465 do_facet ost1 dmesg > $TMP/lustre-log-${TESTNAME}.log
1466 local watchdog=$(awk '/test 18b/ {start = 1;}
1467 /Service thread pid/ && /was inactive/ {
1471 }' $TMP/lustre-log-${TESTNAME}.log)
1472 [ -z "$watchdog" ] || error "$watchdog"
1473 rm -f $TMP/lustre-log-${TESTNAME}.log
1475 run_test 18 "MDS failover while writing, no watchdog triggered (b14840)"
1479 local TESTFILE=$DIR/$tdir/$tfile
1482 trap cleanup_quota_test EXIT
1484 set_ost_qtype "ug" || error "enable ost quota failed"
1486 # bind file to a single OST
1487 $LFS setstripe -c 1 $TESTFILE
1488 chown $TSTUSR.$TSTUSR $TESTFILE
1490 echo "Set user quota (limit: "$blimit"M)"
1491 $LFS setquota -u $TSTUSR -b 0 -B "$blimit"M -i 0 -I 0 $MOUNT
1492 quota_show_check b u $TSTUSR
1493 echo "Update quota limits"
1494 $LFS setquota -u $TSTUSR -b 0 -B "$blimit"M -i 0 -I 0 $MOUNT
1495 quota_show_check b u $TSTUSR
1497 # first wirte might be cached
1498 $RUNAS $DD of=$TESTFILE count=$((blimit + 1))
1499 cancel_lru_locks osc
1501 $RUNAS $DD of=$TESTFILE count=$((blimit + 1)) seek=$((blimit + 1)) &&
1502 quota_error u $TSTUSR "Write success, expect failure"
1506 resetquota -u $TSTUSR
1508 run_test 19 "Updating admin limits doesn't zero operational limits(b14790)"
1510 test_20() { # b15754
1511 local LSTR=(2g 1t 4k 3m) # limits strings
1513 local LVAL=($[2*1024*1024] $[1*1024*1024*1024] $[4*1024] $[3*1024*1024])
1515 resetquota -u $TSTUSR
1517 $LFS setquota -u $TSTUSR --block-softlimit ${LSTR[0]} \
1518 $MOUNT || error "could not set quota limits"
1519 $LFS setquota -u $TSTUSR --block-hardlimit ${LSTR[1]} \
1520 --inode-softlimit ${LSTR[2]} \
1521 --inode-hardlimit ${LSTR[3]} \
1522 $MOUNT || error "could not set quota limits"
1524 [ "$(getquota -u $TSTUSR global bsoftlimit)" = "${LVAL[0]}" ] ||
1525 error "bsoftlimit was not set properly"
1526 [ "$(getquota -u $TSTUSR global bhardlimit)" = "${LVAL[1]}" ] ||
1527 error "bhardlimit was not set properly"
1528 [ "$(getquota -u $TSTUSR global isoftlimit)" = "${LVAL[2]}" ] ||
1529 error "isoftlimit was not set properly"
1530 [ "$(getquota -u $TSTUSR global ihardlimit)" = "${LVAL[3]}" ] ||
1531 error "ihardlimit was not set properly"
1533 resetquota -u $TSTUSR
1535 run_test 20 "Test if setquota specifiers work properly (b15754)"
1542 local time=$(($(date +%s) + seconds))
1543 while [ $(date +%s) -lt $time ]; do
1544 $RUNAS $DD of=$testfile count=$blk_number > /dev/null 2>&1
1548 # run for fixing bug16053, setquota shouldn't fail when writing and
1549 # deleting are happening
1551 local TESTFILE="$DIR/$tdir/$tfile"
1552 local BLIMIT=10 # 10G
1553 local ILIMIT=1000000
1556 trap cleanup_quota_test EXIT
1558 set_ost_qtype "ug" || error "Enable ost quota failed"
1560 log "Set limit(block:${BLIMIT}G; file:$ILIMIT) for user: $TSTUSR"
1561 $LFS setquota -u $TSTUSR -b 0 -B ${BLIMIT}G -i 0 -I $ILIMIT $MOUNT
1562 log "Set limit(block:${BLIMIT}G; file:$ILIMIT) for group: $TSTUSR"
1563 $LFS setquota -g $TSTUSR -b 0 -B $BLIMIT -i 0 -I $ILIMIT $MOUNT
1565 # repeat writing on a 1M file
1566 test_21_sub ${TESTFILE}_1 1 30 &
1568 # repeat writing on a 128M file
1569 test_21_sub ${TESTFILE}_2 128 30 &
1572 local time=$(($(date +%s) + 30))
1574 while [ $(date +%s) -lt $time ]; do
1575 log "Set quota for $i times"
1576 $LFS setquota -u $TSTUSR -b 0 -B "$((BLIMIT + i))G" -i 0 \
1577 -I $((ILIMIT + i)) $MOUNT ||
1578 error "Set user quota failed"
1579 $LFS setquota -g $TSTUSR -b 0 -B "$((BLIMIT + i))G" -i 0 \
1580 -I $((ILIMIT + i)) $MOUNT ||
1581 error "Set group quota failed"
1588 if ! ps -p ${DDPID1} > /dev/null 2>&1; then break; fi
1590 if [ $count -gt 60 ]; then
1591 quota_error a $TSTUSR "dd should be finished!"
1595 echo "(dd_pid=$DDPID1, time=$count)successful"
1599 if ! ps -p ${DDPID2} > /dev/null 2>&1; then break; fi
1601 if [ $count -gt 60 ]; then
1602 quota_error a $TSTUSR "dd should be finished!"
1606 echo "(dd_pid=$DDPID2, time=$count)successful"
1609 resetquota -u $TSTUSR
1610 resetquota -g $TSTUSR
1612 run_test 21 "Setquota while writing & deleting (b16053)"
1614 # enable/disable quota enforcement permanently
1616 echo "Set both mdt & ost quota type as ug"
1617 set_mdt_qtype "ug" || error "enable mdt quota failed"
1618 set_ost_qtype "ug" || error "enable ost quota failed"
1625 echo "Verify if quota is enabled"
1626 local qtype=$(mdt_quota_type)
1627 [ $qtype != "ug" ] && error "mdt quota setting is lost"
1628 qtype=$(ost_quota_type)
1629 [ $qtype != "ug" ] && error "ost quota setting is lost"
1631 echo "Set both mdt & ost quota type as none"
1632 set_mdt_qtype "none" || error "disable mdt quota failed"
1633 set_ost_qtype "none" || error "disable ost quota failed"
1640 echo "Verify if quota is disabled"
1641 qtype=$(mdt_quota_type)
1642 [ $qtype != "none" ] && error "mdt quota setting is lost"
1643 qtype=$(ost_quota_type)
1644 [ $qtype != "none" ] && error "ost quota setting is lost"
1648 run_test 22 "enable/disable quota by 'lctl conf_param'"
1651 local TESTFILE="$DIR/$tdir/$tfile"
1655 trap cleanup_quota_test EXIT
1657 set_ost_qtype "ug" || error "Enable ost quota failed"
1660 log "User quota (limit: $LIMIT MB)"
1661 $LFS setquota -u $TSTUSR -b 0 -B "$LIMIT"M -i 0 -I 0 $DIR
1662 quota_show_check b u $TSTUSR
1664 $LFS setstripe $TESTFILE -c 1 -i 0
1665 chown $TSTUSR.$TSTUSR $TESTFILE
1667 log "Step1: trigger EDQUOT with O_DIRECT"
1668 log "Write half of file"
1669 $RUNAS $DD of=$TESTFILE count=$((LIMIT/2)) oflag=direct ||
1670 quota_error u $TSTUSR "(1) Write failure, expect success." \
1672 log "Write out of block quota ..."
1673 $RUNAS $DD of=$TESTFILE count=$((LIMIT/2 + 1)) seek=$((LIMIT/2)) \
1674 oflag=direct conv=notrunc &&
1675 quota_error u $TSTUSR "(2) Write success, expect EDQUOT." \
1679 log "Step2: rewrite should succeed"
1680 $RUNAS $DD of=$TESTFILE count=1 oflag=direct conv=notrunc||
1681 quota_error u $TSTUSR "(3) Write failure, expect success." \
1687 local OST0_UUID=$(ostuuid_from_index 0)
1688 local OST0_QUOTA_USED=$(getquota -u $TSTUSR $OST0_UUID curspace)
1689 [ $OST0_QUOTA_USED -ne 0 ] &&
1690 ($SHOW_QUOTA_USER; \
1691 quota_error u $TSTUSR "quota isn't released")
1693 resetquota -u $TSTUSR
1697 local OST0_MIN=$((6 * 1024)) # 6MB, extra space for meta blocks.
1698 check_whether_skip && return 0
1699 log "run for 4MB test file"
1702 OST0_MIN=$((60 * 1024)) # 60MB, extra space for meta blocks.
1703 check_whether_skip && return 0
1704 log "run for 40MB test file"
1707 run_test 23 "Quota should be honored with directIO (b16125)"
1711 local TESTFILE="$DIR/$tdir/$tfile"
1714 trap cleanup_quota_test EXIT
1716 set_ost_qtype "ug" || error "enable ost quota failed"
1718 # bind file to a single OST
1719 $LFS setstripe -c 1 $TESTFILE
1720 chown $TSTUSR.$TSTUSR $TESTFILE
1722 echo "Set user quota (limit: "$blimit"M)"
1723 $LFS setquota -u $TSTUSR -b 0 -B "$blimit"M -i 0 -I 0 $MOUNT
1725 # overrun quota by root user
1726 runas -u 0 -g 0 $DD of=$TESTFILE count=$((blimit + 1)) ||
1727 error "write failure, expect success"
1728 cancel_lru_locks osc
1729 sync_all_data || true
1731 $SHOW_QUOTA_USER | grep '*' || error "no matching *"
1734 resetquota -u $TSTUSR
1736 run_test 24 "lfs draws an asterix when limit is reached (b16646)"
1738 test_27a() { # b19612
1739 $LFS quota $TSTUSR $DIR &&
1740 error "lfs succeeded with no type, but should have failed"
1741 $LFS setquota $TSTUSR $DIR &&
1742 error "lfs succeeded with no type, but should have failed"
1745 run_test 27a "lfs quota/setquota should handle wrong arguments (b19612)"
1747 test_27b() { # b20200
1748 $LFS setquota -u $TSTID -b 1000 -B 1000 -i 1000 -I 1000 $DIR ||
1749 error "lfs setquota failed with uid argument"
1750 $LFS setquota -g $TSTID -b 1000 -B 1000 -i 1000 -I 1000 $DIR ||
1751 error "lfs stequota failed with gid argument"
1752 $SHOW_QUOTA_USERID || error "lfs quota failed with uid argument"
1753 $SHOW_QUOTA_GROUPID || error "lfs quota failed with gid argument"
1754 resetquota -u $TSTUSR
1755 resetquota -g $TSTUSR
1758 run_test 27b "lfs quota/setquota should handle user/group ID (b20200)"
1763 local TESTFILE="$DIR/$tdir/$tfile"
1767 trap cleanup_quota_test EXIT
1769 set_ost_qtype "u" || error "enable ost quota failed"
1771 $LFS setstripe $TESTFILE -i 0 -c 1
1772 chown $TSTUSR.$TSTUSR $TESTFILE
1774 $LFS setquota -t -u --block-grace $GRACE --inode-grace $MAX_IQ_TIME $DIR
1775 $LFS setquota -u $TSTUSR -b ${LIMIT}M -B 0 -i 0 -I 0 $DIR
1776 $RUNAS $DD of=$TESTFILE count=$((LIMIT * 2)) || true
1777 cancel_lru_locks osc
1779 $LFS setquota -u $TSTUSR -B 0 $DIR
1780 # over-quota flag has not yet settled since we do not trigger async
1781 # events based on grace time period expiration
1783 $RUNAS $DD of=$TESTFILE conv=notrunc oflag=append count=1 || true
1784 cancel_lru_locks osc
1785 # now over-quota flag should be settled and further writes should fail
1787 $RUNAS $DD of=$TESTFILE conv=notrunc oflag=append count=1 &&
1788 error "grace times were reset"
1791 resetquota -u $TSTUSR
1792 $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace \
1795 run_test 30 "Hard limit updates should not reset grace times"
1797 # basic usage tracking for user & group
1799 local INODES=10 # 10 files
1800 local BLK_CNT=2 # of 2M each
1801 local TOTAL_BLKS=$((INODES * BLK_CNT * 1024))
1804 trap cleanup_quota_test EXIT
1806 # make sure the system is clean
1807 local USED=$(getquota -u $TSTID global curspace)
1809 error "Used space ($USED) for user $TSTID isn't 0."
1810 USED=$(getquota -g $TSTID global curspace)
1812 error "Used space ($USED) for group $TSTID isn't 0."
1814 echo "Write files..."
1815 for i in `seq 0 $INODES`; do
1816 $RUNAS $DD of=$DIR/$tdir/$tfile-$i count=$BLK_CNT 2>/dev/null ||
1817 error "write failed"
1818 echo "Iteration $i/$INODES completed"
1820 cancel_lru_locks osc
1821 sync; sync_all_data || true
1823 echo "Verify disk usage after write"
1824 USED=$(getquota -u $TSTID global curspace)
1825 [ $USED -lt $TOTAL_BLKS ] &&
1826 error "Used space for user $TSTID:$USED, expected:$TOTAL_BLKS"
1827 USED=$(getquota -g $TSTID global curspace)
1828 [ $USED -lt $TOTAL_BLKS ] &&
1829 error "Used space for group $TSTID:$USED, expected:$TOTAL_BLKS"
1831 echo "Verify inode usage after write"
1832 USED=$(getquota -u $TSTID global curinodes)
1833 [ $USED -lt $INODES ] &&
1834 error "Used inode for user $TSTID is $USED, expected $INODES"
1835 USED=$(getquota -g $TSTID global curinodes)
1836 [ $USED -lt $INODES ] &&
1837 error "Used inode for group $TSTID is $USED, expected $INODES"
1841 echo "Verify disk usage after delete"
1842 USED=$(getquota -u $TSTID global curspace)
1843 [ $USED -eq 0 ] || error "Used space for user $TSTID isn't 0. $USED"
1844 USED=$(getquota -u $TSTID global curinodes)
1845 [ $USED -eq 0 ] || error "Used inodes for user $TSTID isn't 0. $USED"
1846 USED=$(getquota -g $TSTID global curspace)
1847 [ $USED -eq 0 ] || error "Used space for group $TSTID isn't 0. $USED"
1848 USED=$(getquota -g $TSTID global curinodes)
1849 [ $USED -eq 0 ] || error "Used inodes for group $TSTID isn't 0. $USED"
1851 run_test 33 "Basic usage tracking for user & group"
1853 # usage transfer test for user & group
1855 local BLK_CNT=2 # 2MB
1858 trap cleanup_quota_test EXIT
1860 # make sure the system is clean
1861 local USED=$(getquota -u $TSTID global curspace)
1862 [ $USED -ne 0 ] && error "Used space ($USED) for user $TSTID isn't 0."
1863 USED=$(getquota -g $TSTID global curspace)
1864 [ $USED -ne 0 ] && error "Used space ($USED) for group $TSTID isn't 0."
1866 echo "Write file..."
1867 $DD of=$DIR/$tdir/$tfile count=$BLK_CNT 2>/dev/null ||
1868 error "write failed"
1869 cancel_lru_locks osc
1870 sync; sync_all_data || true
1872 echo "chown the file to user $TSTID"
1873 chown $TSTID $DIR/$tdir/$tfile || error "chown failed"
1875 echo "Wait for setattr on objects finished..."
1876 wait_delete_completed
1878 BLK_CNT=$((BLK_CNT * 1024))
1880 echo "Verify disk usage for user $TSTID"
1881 USED=$(getquota -u $TSTID global curspace)
1882 [ $USED -lt $BLK_CNT ] &&
1883 error "Used space for user $TSTID is ${USED}, expected $BLK_CNT"
1884 USED=$(getquota -u $TSTID global curinodes)
1886 error "Used inodes for user $TSTID is $USED, expected 1"
1888 echo "chgrp the file to group $TSTID"
1889 chgrp $TSTID $DIR/$tdir/$tfile || error "chgrp failed"
1891 echo "Wait for setattr on objects finished..."
1892 wait_delete_completed
1894 echo "Verify disk usage for group $TSTID"
1895 USED=$(getquota -g $TSTID global curspace)
1896 [ $USED -ge $BLK_CNT ] ||
1897 error "Used space for group $TSTID is $USED, expected $BLK_CNT"
1898 USED=$(getquota -g $TSTID global curinodes)
1900 error "Used inodes for group $TSTID is $USED, expected 1"
1904 run_test 34 "Usage transfer for user & group"
1906 # usage is still accessible across restart
1908 local BLK_CNT=2 # 2 MB
1911 trap cleanup_quota_test EXIT
1913 echo "Write file..."
1914 $RUNAS $DD of=$DIR/$tdir/$tfile count=$BLK_CNT 2>/dev/null ||
1915 error "write failed"
1916 cancel_lru_locks osc
1917 sync; sync_all_data || true
1919 echo "Save disk usage before restart"
1920 local ORIG_USR_SPACE=$(getquota -u $TSTID global curspace)
1921 [ $ORIG_USR_SPACE -eq 0 ] &&
1922 error "Used space for user $TSTID is 0, expected ${BLK_CNT}M"
1923 local ORIG_USR_INODES=$(getquota -u $TSTID global curinodes)
1924 [ $ORIG_USR_INODES -eq 0 ] &&
1925 error "Used inodes for user $TSTID is 0, expected 1"
1926 echo "User $TSTID: ${ORIG_USR_SPACE}KB $ORIG_USR_INODES inodes"
1927 local ORIG_GRP_SPACE=$(getquota -g $TSTID global curspace)
1928 [ $ORIG_GRP_SPACE -eq 0 ] &&
1929 error "Used space for group $TSTID is 0, expected ${BLK_CNT}M"
1930 local ORIG_GRP_INODES=$(getquota -g $TSTID global curinodes)
1931 [ $ORIG_GRP_INODES -eq 0 ] &&
1932 error "Used inodes for group $TSTID is 0, expected 1"
1933 echo "Group $TSTID: ${ORIG_GRP_SPACE}KB $ORIG_GRP_INODES inodes"
1936 local ORIG_REFORMAT=$REFORMAT
1938 cleanup_and_setup_lustre
1939 REFORMAT=$ORIG_REFORMAT
1942 echo "Verify disk usage after restart"
1943 local USED=$(getquota -u $TSTID global curspace)
1944 [ $USED -eq $ORIG_USR_SPACE ] ||
1945 error "Used space for user $TSTID changed from " \
1946 "$ORIG_USR_SPACE to $USED"
1947 USED=$(getquota -u $TSTID global curinodes)
1948 [ $USED -eq $ORIG_USR_INODES ] ||
1949 error "Used inodes for user $TSTID changed from " \
1950 "$ORIG_USR_INODES to $USED"
1951 USED=$(getquota -g $TSTID global curspace)
1952 [ $USED -eq $ORIG_GRP_SPACE ] ||
1953 error "Used space for group $TSTID changed from " \
1954 "$ORIG_GRP_SPACE to $USED"
1955 USED=$(getquota -g $TSTID global curinodes)
1956 [ $USED -eq $ORIG_GRP_INODES ] ||
1957 error "Used inodes for group $TSTID changed from " \
1958 "$ORIG_GRP_INODES to $USED"
1960 # check if the vfs_dq_init() is called before writing
1961 echo "Append to the same file..."
1962 $RUNAS $DD of=$DIR/$tdir/$tfile count=$BLK_CNT seek=1 2>/dev/null ||
1963 error "write failed"
1964 cancel_lru_locks osc
1965 sync; sync_all_data || true
1967 echo "Verify space usage is increased"
1968 USED=$(getquota -u $TSTID global curspace)
1969 [ $USED -gt $ORIG_USR_SPACE ] ||
1970 error "Used space for user $TSTID isn't increased" \
1971 "orig:$ORIG_USR_SPACE, now:$USED"
1972 USED=$(getquota -g $TSTID global curspace)
1973 [ $USED -gt $ORIG_GRP_SPACE ] ||
1974 error "Used space for group $TSTID isn't increased" \
1975 "orig:$ORIG_GRP_SPACE, now:$USED"
1979 run_test 35 "Usage is still accessible across reboot"
1981 # test migrating old amdin quota files (in Linux quota file format v2) into new
1982 # quota global index (in IAM format)
1984 [ $(facet_fstype $SINGLEMDS) != ldiskfs ] && \
1985 skip "skipping migration test" && return
1987 # get the mdt0 device name
1988 local mdt0_node=$(facet_active_host $SINGLEMDS)
1989 local mdt0_dev=$(mdsdevname ${SINGLEMDS//mds/})
1994 echo "Copy admin quota files into MDT0..."
1995 local mntpt=$(facet_mntpt $SINGLEMDS)
1996 local mdt0_fstype=$(facet_fstype $SINGLEMDS)
1997 echo "$mdt0_node, $mdt0_dev, $mntpt"
1998 do_node $mdt0_node mount -t $mdt0_fstype $MDS_MOUNT_OPTS $mdt0_dev $mntpt
1999 do_node $mdt0_node mkdir $mntpt/OBJECTS
2000 do_node $mdt0_node cp $LUSTRE/tests/admin_quotafile_v2.usr $mntpt/OBJECTS
2001 do_node $mdt0_node cp $LUSTRE/tests/admin_quotafile_v2.grp $mntpt/OBJECTS
2002 do_node $mdt0_node umount -f $mntpt
2007 echo "Verify global limits..."
2011 local proc="qmt.*.md-0x0.glb-usr"
2012 id_cnt=$(do_node $mdt0_node $LCTL get_param -n $proc | wc -l)
2013 [ $id_cnt -eq 201 ] || error "Migrate inode user limit failed"
2014 limit=$(getquota -u 1 global isoftlimit)
2015 [ $limit -eq 1024 ] || error "User inode softlimit: $limit"
2016 limit=$(getquota -u 1 global ihardlimit)
2017 [ $limit -eq 2048 ] || error "User inode hardlimit: $limit"
2019 proc="qmt.*.md-0x0.glb-grp"
2020 id_cnt=$(do_node $mdt0_node $LCTL get_param -n $proc | wc -l)
2021 [ $id_cnt -eq 201 ] || error "Migrate inode group limit failed"
2022 limit=$(getquota -g 1 global isoftlimit)
2023 [ $limit -eq 1024 ] || error "Group inode softlimit: $limit"
2024 limit=$(getquota -g 1 global ihardlimit)
2025 [ $limit -eq 2048 ] || error "Group inode hardlimit: $limit"
2027 proc=" qmt.*.dt-0x0.glb-usr"
2028 id_cnt=$(do_node $mdt0_node $LCTL get_param -n $proc | wc -l)
2029 [ $id_cnt -eq 201 ] || error "Migrate block user limit failed"
2030 limit=$(getquota -u 60001 global bsoftlimit)
2031 [ $limit -eq 10485760 ] || error "User block softlimit: $limit"
2032 limit=$(getquota -u 60001 global bhardlimit)
2033 [ $limit -eq 20971520 ] || error "User block hardlimit: $limit"
2035 proc="qmt.*.dt-0x0.glb-grp"
2036 id_cnt=$(do_node $mdt0_node $LCTL get_param -n $proc | wc -l)
2037 [ $id_cnt -eq 201 ] || error "Migrate block user limit failed"
2038 limit=$(getquota -g 60001 global bsoftlimit)
2039 [ $limit -eq 10485760 ] || error "Group block softlimit: $limit"
2040 limit=$(getquota -g 60001 global bhardlimit)
2041 [ $limit -eq 20971520 ] || error "Group block hardlimit: $limit"
2047 run_test 36 "Migrate old admin files into new global indexes"
2051 do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=-quota"
2056 complete $(basename $0) $SECONDS
2057 check_and_cleanup_lustre
2058 export USE_OFD="$USE_OFD_OLD"
2059 export LOAD_MODULES_REMOTE="$LOAD_MODULES_REMOTE_OLD"
2060 export QUOTA_AUTO=$QUOTA_AUTO_OLD