}
run_test 160d "verify that changelog log catch the migrate event"
+test_160e() {
+ # Create a user
+ CL_USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 \
+ changelog_register -n)
+ echo "Registered as changelog user $CL_USER"
+ trap cleanup_changelog EXIT
+
+ # Delete a future user (expect fail)
+ do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister cl77
+ local rc=$?
+
+ if [ $rc -eq 0 ]; then
+ error "Deleted non-existant user cl77"
+ elif [ $rc -ne 2 ]; then
+ error "changelog_deregister failed with $rc, " \
+ "expected 2 (ENOENT)"
+ fi
+
+ # Clear to a bad index (1 billion should be safe)
+ $LFS changelog_clear $MDT0 $CL_USER 1000000000
+ rc=$?
+
+ if [ $rc -eq 0 ]; then
+ error "Successfully cleared to invalid CL index"
+ elif [ $rc -ne 22 ]; then
+ error "changelog_clear failed with $rc, expected 22 (EINVAL)"
+ fi
+}
+run_test 160e "changelog negative testing"
+
test_161a() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
test_mkdir -p -c1 $DIR/$tdir
do_facet ost$((OSTIDX + 1)) lctl set_param fail_val=-1
#define OBD_FAIL_OST_ENOINO 0x229
do_facet ost$((OSTIDX + 1)) lctl set_param fail_loc=0x229
- do_facet mgs $LCTL pool_new $FSNAME.$TESTNAME || return 1
+ create_pool $FSNAME.$TESTNAME || return 1
do_facet mgs $LCTL pool_add $FSNAME.$TESTNAME $OST || return 2
$SETSTRIPE $DIR/$tdir -i $OSTIDX -c 1 -p $FSNAME.$TESTNAME
remote_mds_nodsh && skip "remote MDS with nodsh" && return
remote_mgs_nodsh && skip "remote MGS with nodsh" && return
- local ost_name=$($LFS osts | grep ${ostidx}": " | \
- awk '{print $2}' | sed -e 's/_UUID$//')
+ local ost_name=$($LFS osts |
+ sed -n 's/^'$ostidx': \(.*\)_UUID .*/\1/p')
# on the mdt's osc
local mdtosc_proc1=$(get_mdtosc_proc_path $SINGLEMDS $ost_name)
do_facet $SINGLEMDS $LCTL get_param -n \
osp.$mdtosc_proc1.reserved_mb_low)
echo "prev high watermark $last_wm_h, prev low watermark $last_wm_l"
- do_facet mgs $LCTL pool_new $FSNAME.$TESTNAME ||
- error "Pool creation failed"
+ create_pool $FSNAME.$TESTNAME || error "Pool creation failed"
do_facet mgs $LCTL pool_add $FSNAME.$TESTNAME $ost_name ||
error "Adding $ost_name to pool failed"
local new_iused
for i in $(seq 120); do
new_iused=$($LFS df -i | grep OST0000 | awk '{ print $3 }')
- [ $((old_iused - new_iused)) -gt 800 ] && break
+ # system may be too busy to destroy all objs in time, use
+ # a somewhat small value to not fail autotest
+ [ $((old_iused - new_iused)) -gt 400 ] && break
sleep 1
done
echo "waited $i sec, old Iused $old_iused, new Iused $new_iused"
- [ $((old_iused - new_iused)) -gt 800 ] ||
+ [ $((old_iused - new_iused)) -gt 400 ] ||
error "objs not destroyed after unlink"
}
run_test 311 "disable OSP precreate, and unlink should destroy objs"
}
run_test 313 "io should fail after last_rcvd update fail"
-test_399() { # LU-7655 for OST fake write
+test_fake_rw() {
+ local read_write=$1
+ if [ "$read_write" = "write" ]; then
+ local dd_cmd="dd if=/dev/zero of=$DIR/$tfile"
+ elif [ "$read_write" = "read" ]; then
+ local dd_cmd="dd of=/dev/null if=$DIR/$tfile"
+ else
+ error "argument error"
+ fi
+
# turn off debug for performance testing
local saved_debug=$($LCTL get_param -n debug)
$LCTL set_param debug=0
local blocks=$((ost1_avail_size/2/1024)) # half avail space by megabytes
[ $blocks -gt 1000 ] && blocks=1000 # 1G in maximum
+ if [ "$read_write" = "read" ]; then
+ truncate -s $(expr 1048576 \* $blocks) $DIR/$tfile
+ fi
+
local start_time=$(date +%s.%N)
- dd if=/dev/zero of=$DIR/$tfile bs=1M count=$blocks oflag=sync ||
- error "real dd writing error"
+ $dd_cmd bs=1M count=$blocks oflag=sync ||
+ error "real dd $read_write error"
local duration=$(bc <<< "$(date +%s.%N) - $start_time")
- rm -f $DIR/$tfile
- # define OBD_FAIL_OST_FAKE_WRITE 0x238
+ if [ "$read_write" = "write" ]; then
+ rm -f $DIR/$tfile
+ fi
+
+ # define OBD_FAIL_OST_FAKE_RW 0x238
do_facet ost1 $LCTL set_param fail_loc=0x238
local start_time=$(date +%s.%N)
- dd if=/dev/zero of=$DIR/$tfile bs=1M count=$blocks oflag=sync ||
- error "fake dd writing error"
+ $dd_cmd bs=1M count=$blocks oflag=sync ||
+ error "fake dd $read_write error"
local duration_fake=$(bc <<< "$(date +%s.%N) - $start_time")
- # verify file size
- cancel_lru_locks osc
- $CHECKSTAT -t file -s $((blocks * 1024 * 1024)) $DIR/$tfile ||
- error "$tfile size not $blocks MB"
-
+ if [ "$read_write" = "write" ]; then
+ # verify file size
+ cancel_lru_locks osc
+ $CHECKSTAT -t file -s $((blocks * 1024 * 1024)) $DIR/$tfile ||
+ error "$tfile size not $blocks MB"
+ fi
do_facet ost1 $LCTL set_param fail_loc=0
- echo "fake write $duration_fake vs. normal write $duration in seconds"
+ echo "fake $read_write $duration_fake vs. normal $read_write" \
+ "$duration in seconds"
[ $(bc <<< "$duration_fake < $duration") -eq 1 ] ||
error_not_in_vm "fake write is slower"
$LCTL set_param -n debug="$saved_debug"
rm -f $DIR/$tfile
}
-run_test 399 "fake write should not be slower than normal write"
+test_399a() { # LU-7655 for OST fake write
+ test_fake_rw write
+}
+run_test 399a "fake write should not be slower than normal write"
+
+
+test_399b() { # LU-8726 for OST fake read
+ if [ "$(facet_fstype ost1)" != "ldiskfs" ]; then
+ skip "only for ldiskfs" && return 0
+ fi
+ test_fake_rw read
+}
+run_test 399b "fake read should not be slower than normal read"
test_400a() { # LU-1606, was conf-sanity test_74
local extra_flags=''