local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
create_dir $POOL_ROOT ${POOL}1234567
stack_trap "rm -f $POOL_ROOT/file"
- dd if=/dev/zero of=$POOL_ROOT/file bs=1M count=100
+ $DD of=$POOL_ROOT/file count=100
RC=$?; [[ $RC -eq 0 ]] ||
error "failed to write to $POOL_ROOT/file: $RC"
do_facet mgs lctl pool_remove $FSNAME.${POOL}1234567 OST0000
OST0_SIZE=$($LFS df $POOL_ROOT/dir2 | awk '/\[OST:0\]/ { print $4 }')
FILE_SIZE=$((OST0_SIZE/1024/10))
echo "Filling OST0 with 9 files of ${FILE_SIZE}MB in $POOL_ROOT/dir2"
- i=1
- while [[ $i -lt 10 ]]; do
- dd if=/dev/zero of=$POOL_ROOT/dir2/f${i} bs=1M count=$FILE_SIZE
- i=$((i + 1))
+ for ((i = 1; $i < 10; i++)); do
+ $DD of=$POOL_ROOT/dir2/f${i} count=$FILE_SIZE
done
sleep 1 # get new statfs info
$LFS df $POOL_ROOT/dir2
# This does two "dd" runs to ensure that the quota failure is returned
# to userspace when we check. The first "dd" might otherwise complete
# without error if it is only writing into cache.
- stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
- count=$((BUNIT_SZ*2)) 2>&1)
+ stat=$(LOCALE=C $RUNAS $DD of=$file bs=$BUNIT_SZ count=$((BUNIT_SZ*2)) 2>&1)
echo $stat | grep "Disk quota exceeded" > /dev/null
if [ $? -eq 0 ]; then
$LFS quota -v -u $RUNAS_ID $dir
cancel_lru_locks osc
stack_trap "rm -f $file"
- stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
- count=$BUNIT_SZ seek=$((BUNIT_SZ*2)) 2>&1)
+ stat=$(LOCALE=C $RUNAS $DD of=$file bs=$BUNIT_SZ \
+ count=$BUNIT_SZ seek=$((BUNIT_SZ*2)) 2>&1)
RC=$?
echo $stat
- [[ $RC -eq 0 ]] && error "second dd did not fail."
+ (( $RC != 0 )) || error "second dd did not fail."
echo $stat | grep "Disk quota exceeded" > /dev/null
- [[ $? -eq 1 ]] && error "second dd did not fail with EDQUOT."
+ (( $? != 1 )) || error "second dd did not fail with EDQUOT."
else
log "first dd failed with EDQUOT."
fi
}
local i=0
- local TGT
local dir=$POOL_ROOT/dir
local file="$dir/$tfile-quota"
create_pool_nofail $POOL
- local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
+ local tgt=$(for ((i = 0x$TGT_FIRST; i <= 0x$TGT_MAX; i += 3)); do
printf "$FSNAME-OST%04x_UUID " $i; done)
- add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
+ add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$tgt"
create_dir $dir $POOL
+ stack_trap "rm -rf $POOL_ROOT; wait_delete_completed"
+ $LFS df -p $POOL $dir
local maxfree=$((1024 * 1024 * 30)) # 30G
- local AVAIL=$(lfs_df -p $POOL $dir | awk '/summary/ { print $4 }')
- [ $AVAIL -gt $maxfree ] &&
- skip_env "Filesystem space $AVAIL is larger than " \
- "$maxfree limit"
+ local avail=$(lfs_df -p $POOL $dir | awk '/summary/ { print $4 }')
+ (( $avail <= $maxfree )) ||
+ skip_env "Filesystem space $avail > $maxfree limit"
- echo "OSTCOUNT=$OSTCOUNT, OSTSIZE=$OSTSIZE, AVAIL=$AVAIL"
- echo "MAXFREE=$maxfree, SLOW=$SLOW"
+ echo "OSTCOUNT=$OSTCOUNT, OSTSIZE=$OSTSIZE, SLOW=$SLOW, POOL=$POOL"
+ echo "pool_avail=$avail, maxfree=$maxfree"
- # XXX remove the interoperability code once we drop the old server
- # ( < 2.3.50) support.
- if [ "$MDS1_VERSION" -lt $(version_code 2.3.50) ]; then
- $LFS quotaoff -ug $MOUNT
+ if [[ $PERM_CMD == *"set_param -P"* ]]; then
+ do_facet mgs $PERM_CMD \
+ osd-*.$FSNAME-OST*.quota_slave.enabled=none
else
- if [[ $PERM_CMD == *"set_param -P"* ]]; then
- do_facet mgs $PERM_CMD \
- osd-*.$FSNAME-OST*.quota_slave.enabled=none
- else
- do_facet mgs $PERM_CMD $FSNAME.quota.ost=none
- fi
- sleep 5
+ do_facet mgs $PERM_CMD $FSNAME.quota.ost=none
fi
+ sleep 5
chown $RUNAS_ID.$RUNAS_ID $dir
i=0
- local RC=0
- local TOTAL=0 # KB
- local stime=$(date +%s)
- local stat
- local etime
- local elapsed
+ local rc=0
+ local total=0 # KB
+ local wr_mb=$((5 * 1024))
+ local stime=$SECONDS
local maxtime=300 # minimum speed: 5GB / 300sec ~= 17MB/s
- while [ $RC -eq 0 ]; do
- i=$((i + 1))
- stat=$(LOCALE=C $RUNAS2 dd if=/dev/zero of=${file}$i bs=1M \
- count=$((5 * 1024)) 2>&1)
- RC=$?
- TOTAL=$((TOTAL + 1024 * 1024 * 5))
- echo "[$i iteration] $stat"
- echo "total written: $TOTAL"
- etime=$(date +%s)
+ while (( $rc == 0 )); do
+ local stat
+ local etime
+ local elapsed
+
+ i=$((i + 1))
+ # use urandom to avoid data compression
+ stat=$(LOCALE=C $RUNAS2 $DD of=$file.$i count=$wr_mb 2>&1)
+ rc=$?
+ ((total += wr_mb * 1024))
+ echo "iteration $i: $stat"
+ ls -ls $file.*
+ echo "total written: $total"
+
+ etime=$SECONDS
elapsed=$((etime - stime))
- echo "stime=$stime, etime=$etime, elapsed=$elapsed"
+ echo "start=$stime, end=$etime, elapsed=$elapsed"
- if [ $RC -eq 1 ]; then
+ if (( $rc == 1 )); then
echo $stat | grep -q "Disk quota exceeded"
- [[ $? -eq 0 ]] &&
+ (( $? != 0 )) ||
error "dd failed with EDQUOT with quota off"
echo $stat | grep -q "No space left on device"
- [[ $? -ne 0 ]] &&
- error "dd did not fail with ENOSPC"
- elif [ $TOTAL -gt $AVAIL ]; then
- error "dd didn't fail with ENOSPC ($TOTAL > $AVAIL)"
- elif [ $i -eq 1 -a $elapsed -gt $maxtime ]; then
- log "The first 5G write used $elapsed (> $maxtime) " \
- "seconds, terminated"
- RC=1
+ (( $? == 0 )) || error "dd did not fail with ENOSPC"
+ elif (( $total > $avail )); then
+ error "dd didn't fail with ENOSPC ($total > $avail)"
+ elif (( $i == 1 && $elapsed > $maxtime )); then
+ skip "5G write used $elapsed > $maxtime sec, give up"
+ rc=1
fi
done
df -h
- rm -rf $POOL_ROOT
}
run_test 23b "OST pools and OOS"
start_full_debug_logging
#$LFS setstripe -E 4M -c 1 -p $POOL -E 16M -c 2 $DIR/$tfile
$LFS setstripe -c 1 -p $POOL $DIR/$tfile
- dd if=/dev/urandom of=$DIR/$tfile bs=1M count=1 seek=16
+ $DD of=$DIR/$tfile count=1 seek=16
local csum=$(cksum $DIR/$tfile)
$LFS getstripe $DIR/$tfile
local pool="$($LFS getstripe -p $DIR/$tfile)"
ALWAYS_EXCEPT+=""
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
+if [[ "$ost1_FSTYPE" == "zfs" ]]; then
+ always_except LU-18676 49
+fi
+
# Test duration: 30 min
[ "$SLOW" = "no" ] && EXCEPT_SLOW="61"
RUNAS="runas -u $TSTID -g $TSTID"
RUNAS2="runas -u $TSTID2 -g $TSTID2"
-DD="dd if=/dev/zero bs=1M"
FAIL_ON_ERROR=false
cancel_lru_locks osc
echo "Write to exceed soft limit"
- $RUNAS dd if=/dev/zero of=$testfile bs=1K count=10 seek=$OFFSET ||
+ $RUNAS $DD of=$testfile bs=1K count=10 seek=$OFFSET ||
quota_error a $TSTUSR "write failure, but expect success"
OFFSET=$((OFFSET + 1024)) # make sure we don't write to same block
cancel_lru_locks osc
$SHOW_QUOTA_INFO_PROJID
echo "Write before timer goes off"
- $RUNAS dd if=/dev/zero of=$testfile bs=1K count=10 seek=$OFFSET ||
+ $RUNAS $DD of=$testfile bs=1K count=10 seek=$OFFSET ||
quota_error a $TSTUSR "write failure, but expect success"
OFFSET=$((OFFSET + 1024))
cancel_lru_locks osc
# maybe cache write, ignore.
# write up to soft least quint to consume all
# possible slave granted space.
- $RUNAS dd if=/dev/zero of=$testfile bs=1K \
- count=$soft_limit seek=$OFFSET || true
+ $RUNAS $DD of=$testfile bs=1K count=$soft_limit seek=$OFFSET || true
OFFSET=$((OFFSET + soft_limit))
cancel_lru_locks osc
log "Write after cancel lru locks"
- $RUNAS dd if=/dev/zero of=$testfile bs=1K count=10 seek=$OFFSET &&
+ $RUNAS $DD of=$testfile bs=1K count=10 seek=$OFFSET &&
quota_error a $TSTUSR "write success, but expect EDQUOT"
$SHOW_QUOTA_USER
usermod -G $TSTUSR,$TSTUSR2 $TSTUSR
#prepare test file
- $RUNAS dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1024 count=100000 ||
- error "failed to dd"
+ $RUNAS $DD of=$DIR/$tdir/$tfile bs=1024 count=100000 ||
+ error "failed to dd"
cancel_lru_locks osc
sync; sync_all_data || true
$LFS setquota -u $TSTUSR -B ${limit}M --pool $qpool $DIR ||
error "set user quota failed"
- $RUNAS dd if=/dev/zero of="$dom0/f1" bs=1K count=512 oflag=sync ||
+ $RUNAS $DD of="$dom0/f1" bs=1K count=512 oflag=sync ||
quota_error u $TSTUSR "write failed"
- $RUNAS dd if=/dev/zero of="$dom0/f1" bs=1K count=512 seek=512 \
- oflag=sync || quota_error u $TSTUSR "write failed"
+ $RUNAS $DD of="$dom0/f1" bs=1K count=512 seek=512 oflag=sync ||
+ quota_error u $TSTUSR "write failed"
$RUNAS $DD of=$testfile count=$limit || true
# Now all members of qpool1 should get EDQUOT. Expect success
# when write to DOM on MDT0, as it belongs to global pool.
- $RUNAS dd if=/dev/zero of="$dom0/f1" bs=1K count=512 \
- oflag=sync || quota_error u $TSTUSR "write failed"
+ $RUNAS $DD of="$dom0/f1" bs=1K count=512 oflag=sync ||
+ quota_error u $TSTUSR "write failed"
- $RUNAS dd if=/dev/zero of="$dom0/f1" bs=1K count=512 seek=512 \
- oflag=sync || quota_error u $TSTUSR "write failed"
+ $RUNAS $DD of="$dom0/f1" bs=1K count=512 seek=512 oflag=sync ||
+ quota_error u $TSTUSR "write failed"
}
run_test 69 "EDQUOT at one of pools shouldn't affect DOM"
cancel_lru_locks osc
echo "Write to exceed soft limit"
- dd if=/dev/zero of=$testfile bs=1K count=10 seek=$OFFSET ||
+ $DD of=$testfile bs=1K count=10 seek=$OFFSET ||
quota_error a $TSTUSR "root write failure, but expect success (2)"
OFFSET=$((OFFSET + 1024)) # make sure we don't write to same block
cancel_lru_locks osc