}
run_test 39c "check truncate mtime update ======================"
+test_39d() { # LU-7310
+ touch $DIR1/$tfile
+ touch -m -d @$TEST_39_MTIME $DIR1/$tfile
+
+ local mtime1=$(stat -c %Y $DIR2/$tfile)
+ [ "$mtime1" = $TEST_39_MTIME ] ||
+ error "mtime: $mtime1, should be $TEST_39_MTIME"
+
+ # force sync write
+ # define OBD_FAIL_OSC_NO_GRANT 0x411
+ $LCTL set_param fail_loc=0x411
+
+ local d1=$(date +%s)
+ echo hello >> $DIR1/$tfile
+ local d2=$(date +%s)
+
+ $LCTL set_param fail_loc=0
+
+ cancel_lru_locks osc
+
+ local mtime2=$(stat -c %Y $DIR2/$tfile)
+ [ "$mtime2" -ge "$d1" ] && [ "$mtime2" -le "$d2" ] ||
+ error "mtime is not updated on write: $d1 <= $mtime2 <= $d2"
+}
+run_test 39d "sync write should update mtime"
+
# check that pid exists hence second operation wasn't blocked by first one
# if it is so then there is no conflict, return 0
# else second operation is conflicting with first one, return 1
echo "==> rename vs getattr vs setxattr should not deadlock"
mkdir -p $DIR/d1/d2/d3 || error "(1) mkdir failed"
- do_facet mds $LCTL set_param fail_loc=$1
+ do_facet mds1 $LCTL set_param fail_loc=$1
mv -T $DIR/d1/d2/d3 $DIR/d1/d3 &
PID1=$!
echo "==> rename vs getattr vs open vs getattr should not deadlock"
mkdir -p $DIR/d1/d2/d3 || error "(1) mkdir failed"
- do_facet mds $LCTL set_param fail_loc=$1
+ do_facet mds1 $LCTL set_param fail_loc=$1
mv -T $DIR/d1/d2/d3 $DIR/d1/d3 &
PID1=$!
mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
#define OBD_FAIL_MDS_RENAME4 0x156
- do_facet mds $LCTL set_param fail_loc=0x80000156
+ do_facet mds1 $LCTL set_param fail_loc=0x80000156
mv -T $DIR/d1/d2 $DIR/d3/d2 &
PID1=$!
mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
#define OBD_FAIL_MDS_RENAME4 0x156
- do_facet mds $LCTL set_param fail_loc=0x80000156
+ do_facet mds1 $LCTL set_param fail_loc=0x80000156
mv -T $DIR/d1/d2 $DIR/d3/d2 &
PID1=$!
mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
#define OBD_FAIL_MDS_RENAME4 0x156
- do_facet mds $LCTL set_param fail_loc=0x156
+ do_facet mds1 $LCTL set_param fail_loc=0x156
mv -T $DIR/d1/d2 $DIR/d3/d2 &
PID1=$!
touch $DIR/f1
#define OBD_FAIL_MDS_RENAME3 0x155
- do_facet mds $LCTL set_param fail_loc=0x155
+ do_facet mds1 $LCTL set_param fail_loc=0x155
mv $DIR/f1 $DIR/$tdir &
PID1=$!
sleep 2
$LFS setstripe -c $OSTCOUNT $dir || error "setstripe to $dir failed"
chmod 777 $dir
- do_nodes $CLIENTS $myRUNAS dd if=/dev/zero of="$dir/nrs_r_$HOSTNAME"\
- bs=1M count=$n > /dev/null 2>&1 || error "dd on client failed"
+ do_nodes $CLIENTS $myRUNAS \
+ dd if=/dev/zero of="$dir/nrs_r_$HOSTNAME" bs=1M count=$n ||
+ error "dd at 0 on client failed (1)"
for ((i = 0; i < $n; i++)); do
- do_nodes $CLIENTS $myRUNAS dd if=/dev/zero\
- of="$dir/nrs_w_$HOSTNAME" bs=1M seek=$i count=1\
- > /dev/null 2>&1 || error "dd on client failed" &
+ do_nodes $CLIENTS $myRUNAS dd if=/dev/zero \
+ of="$dir/nrs_w_$HOSTNAME" bs=1M seek=$i count=1 ||
+ error "dd at ${i}MB on client failed (2)" &
local pids_w[$i]=$!
done
do_nodes $CLIENTS sync;
cancel_lru_locks osc
for ((i = 0; i < $n; i++)); do
- do_nodes $CLIENTS $myRUNAS dd if="$dir/nrs_w_$HOSTNAME"\
- of=/dev/zero bs=1M seek=$i count=1 > /dev/null 2>&1 ||
- error "dd on client failed"
+ do_nodes $CLIENTS $myRUNAS dd if="$dir/nrs_w_$HOSTNAME" \
+ of=/dev/zero bs=1M seek=$i count=1 > /dev/null ||
+ error "dd at ${i}MB on client failed (3)"
local pids_r[$i]=$!
done
cancel_lru_locks osc
error "failed to run operate '$*' on TBF rules"
}
+tbf_verify() {
+ local dir=$DIR/$tdir
+ local client1=${CLIENT1:-`hostname`}
+ local myRUNAS="$3"
+
+ mkdir $dir || error "mkdir $dir failed"
+ $LFS setstripe -c 1 $dir || error "setstripe to $dir failed"
+ chmod 777 $dir
+
+ echo "Limited write rate: $1, read rate: $2"
+ echo "Verify the write rate is under TBF control"
+ local rate=$(do_node $client1 $myRUNAS dd if=/dev/zero of=$dir/tbf \
+ bs=1M count=100 oflag=direct 2>&1 | awk '/bytes/ {print $8}')
+ echo "Write speed is $rate"
+
+ # verify the write rate does not exceed 110% of TBF limited rate
+ [ $(bc <<< "$rate < 1.1 * $1") -eq 1 ] ||
+ error "The write rate ($rate) exceeds 110% of preset rate ($1)"
+
+ cancel_lru_locks osc
+
+ echo "Verify the read rate is under TBF control"
+ rate=$(do_node $client1 $myRUNAS dd if=$dir/tbf of=/dev/null \
+ bs=1M count=100 iflag=direct 2>&1 | awk '/bytes/ {print $8}')
+ echo "Read speed is $rate"
+
+ # verify the read rate does not exceed 110% of TBF limited rate
+ [ $(bc <<< "$rate < 1.1 * $2") -eq 1 ] ||
+ error "The read rate ($rate) exceeds 110% of preset rate ($2)"
+
+ rm -rf $dir || error "rm -rf $dir failed"
+}
+
test_77e() {
+ local server_version=$(lustre_version_code ost1)
+ [[ $server_version -ge $(version_code 2.7.58) ]] ||
+ { skip "Need server version newer than 2.7.57"; return 0; }
+
oss=$(comma_list $(osts_nodes))
do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ nid"
run_test 77e "check TBF NID nrs policy"
test_77f() {
+ local server_version=$(lustre_version_code ost1)
+ [[ $server_version -ge $(version_code 2.7.58) ]] ||
+ { skip "Need server version newer than 2.7.57"; return 0; }
+
oss=$(comma_list $(osts_nodes))
# Configure jobid_var
run_test 77f "check TBF JobID nrs policy"
test_77g() {
+ local server_version=$(lustre_version_code ost1)
+ [[ $server_version -ge $(version_code 2.7.58) ]] ||
+ { skip "Need server version newer than 2.7.57"; return 0; }
+
oss=$(comma_list $(osts_nodes))
do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ nid"
}
run_test 77i "Change rank of TBF rule"
+test_77j() {
+ local idis
+ local rateis
+ if [ $(lustre_version_code ost1) -ge $(version_code 2.8.60) ]; then
+ idis="opcode="
+ rateis="rate="
+ fi
+
+ do_nodes $(comma_list $(osts_nodes)) \
+ lctl set_param jobid_var=procname_uid \
+ ost.OSS.ost_io.nrs_policies="tbf\ opcode" \
+ ost.OSS.ost_io.nrs_tbf_rule="start\ ost_r\ ${idis}{ost_read}\ ${rateis}5" \
+ ost.OSS.ost_io.nrs_tbf_rule="start\ ost_w\ ${idis}{ost_write}\ ${rateis}20"
+
+ nrs_write_read
+ tbf_verify 20 5
+
+ do_nodes $(comma_list $(osts_nodes)) \
+ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ost_r" \
+ ost.OSS.ost_io.nrs_tbf_rule="stop\ ost_w" \
+ ost.OSS.ost_io.nrs_policies="fifo"
+
+ # sleep 3 seconds to wait the tbf policy stop completely,
+ # or the next test case is possible get -EAGAIN when
+ # setting the tbf policy
+ sleep 3
+}
+run_test 77j "check TBF-OPCode NRS policy"
+
test_78() { #LU-6673
+ local server_version=$(lustre_version_code ost1)
+ [[ $server_version -ge $(version_code 2.7.58) ]] ||
+ { skip "Need server version newer than 2.7.57"; return 0; }
+
local rc
oss=$(comma_list $(osts_nodes))
}
run_test 78 "Enable policy and specify tunings right away"
+test_79() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ test_mkdir -p $DIR/$tdir
+
+ # Prevent interference from layout intent RPCs due to
+ # asynchronous writeback. These will be tested in 130c below.
+ do_nodes ${CLIENTS:-$HOSTNAME} sync
+
+ setfattr -n trusted.name1 -v value1 $DIR/$tdir ||
+ error "setfattr -n trusted.name1=value1 $DIR/$tdir failed"
+
+#define OBD_FAIL_MDS_INTENT_DELAY 0x160
+ local mdtidx=$($LFS getstripe -M $DIR/$tdir)
+ local facet=mds$((mdtidx + 1))
+ stat $DIR/$tdir
+ set_nodes_failloc $(facet_active_host $facet) 0x80000160
+ getfattr -n trusted.name1 $DIR/$tdir 2> /dev/null &
+ local pid=$!
+ sleep 2
+
+#define OBD_FAIL_MDS_GETXATTR_PACK 0x131
+ set_nodes_failloc $(facet_active_host $facet) 0x80000131
+
+ wait $pid
+ return 0
+}
+run_test 79 "xattr: intent error"
+
test_80a() {
[ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
local MDTIDX=1
}
run_test 92 "create remote directory under orphan directory"
+test_93() {
+ local rc1=0
+ local rc2=0
+ local old_rr
+
+ mkdir -p $DIR1/$tfile-1/
+ mkdir -p $DIR2/$tfile-2/
+ local old_rr=$(do_facet $SINGLEMDS lctl get_param -n \
+ 'lod.lustre-MDT*/qos_threshold_rr' | sed -e 's/%//')
+ do_facet $SINGLEMDS lctl set_param -n \
+ 'lod.lustre-MDT*/qos_threshold_rr' 100
+ #define OBD_FAIL_MDS_LOV_CREATE_RACE 0x163
+ do_facet $SINGLEMDS "lctl set_param fail_loc=0x00000163"
+
+ $SETSTRIPE -c -1 $DIR1/$tfile-1/file1 &
+ local PID1=$!
+ sleep 1
+ $SETSTRIPE -c -1 $DIR2/$tfile-2/file2 &
+ local PID2=$!
+ wait $PID2
+ wait $PID1
+ do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
+ do_facet $SINGLEMDS "lctl set_param -n \
+ 'lod.lustre-MDT*/qos_threshold_rr' $old_rr"
+
+ $GETSTRIPE $DIR1/$tfile-1/file1
+ rc1=$($GETSTRIPE -q $DIR1/$tfile-1/file1 |
+ awk '{if (/[0-9]/) print $1 }' | sort | uniq -d | wc -l)
+ $GETSTRIPE $DIR2/$tfile-2/file2
+ rc2=$($GETSTRIPE -q $DIR2/$tfile-2/file2 |
+ awk '{if (/[0-9]/) print $1 }' | sort | uniq -d | wc -l)
+ echo "rc1=$rc1 and rc2=$rc2 "
+ [ $rc1 -eq 0 ] && [ $rc2 -eq 0 ] ||
+ error "object allocate on same ost detected"
+}
+run_test 93 "alloc_rr should not allocate on same ost"
+
log "cleanup: ======================================================"
# kill and wait in each test only guarentee script finish, but command in script