}
run_test 27ce "more stripes than OSTs with -o"
+test_27cf() {
+ local osp_proc="osp.$FSNAME-OST0000-osc-MDT000*.active"
+ local pid=0
+
+ test_mkdir -p $DIR/$tdir || error "failed to mkdir $DIR/$tdir"
+ do_facet $SINGLEMDS "$LCTL set_param -n $osp_proc=0"
+ stack_trap "do_facet $SINGLEMDS $LCTL set_param -n $osp_proc=1" EXIT
+ wait_update_facet $SINGLEMDS "$LCTL get_param -n $osp_proc | grep 1" ||
+ error "failed to set $osp_proc=0"
+
+ $LFS setstripe -o 0 $DIR/$tdir/$tfile &
+ pid=$!
+ sleep 1
+ do_facet $SINGLEMDS "$LCTL set_param -n $osp_proc=1"
+ wait_update_facet $SINGLEMDS "$LCTL get_param -n $osp_proc | grep 0" ||
+ error "failed to set $osp_proc=1"
+ wait $pid
+ [[ $pid -ne 0 ]] ||
+ error "should return error due to $osp_proc=0"
+}
+run_test 27cf "'setstripe -o' on inactive OSTs should return error"
+
test_27d() {
test_mkdir $DIR/$tdir
$LFS setstripe -c 0 -i -1 -S 0 $DIR/$tdir/$tfile ||
}
run_test 33g "nonroot user create already existing root created file"
+test_33h() {
+ [ $MDSCOUNT -lt 2 ] && skip_env "needs >= 2 MDTs"
+ [ $MDS1_VERSION -lt $(version_code 2.13.50) ] &&
+ skip "Need MDS version at least 2.13.50"
+
+ test_mkdir -c $MDSCOUNT -H crush $DIR/$tdir ||
+ error "mkdir $tdir failed"
+ touch $DIR/$tdir/$tfile || error "touch $tfile failed"
+
+ local index=$($LFS getstripe -m $DIR/$tdir/$tfile)
+ local index2
+
+ for fname in $DIR/$tdir/$tfile.bak \
+ $DIR/$tdir/$tfile.SAV \
+ $DIR/$tdir/$tfile.orig \
+ $DIR/$tdir/$tfile~; do
+ touch $fname || error "touch $fname failed"
+ index2=$($LFS getstripe -m $fname)
+ [ $index -eq $index2 ] ||
+ error "$fname MDT index mismatch $index != $index2"
+ done
+
+ local failed=0
+ for i in {1..50}; do
+ for fname in $(mktemp -u $DIR/$tdir/.$tfile.XXXXXX) \
+ $(mktemp $DIR/$tdir/$tfile.XXXXXXXX); do
+ touch $fname || error "touch $fname failed"
+ index2=$($LFS getstripe -m $fname)
+ if [[ $index != $index2 ]]; then
+ failed=$((failed + 1))
+ echo "$fname MDT index mismatch $index != $index2"
+ fi
+ done
+ done
+ echo "$failed MDT index mismatches"
+ (( failed < 4 )) || error "MDT index mismatch $failed times"
+
+}
+run_test 33h "temp file is located on the same MDT as target"
+
TEST_34_SIZE=${TEST_34_SIZE:-2000000000000}
test_34a() {
rm -f $DIR/f34
}
run_test 39p "remote directory cached attributes updated after create ========"
+test_39r() {
+ [ $OST1_VERSION -ge $(version_code 2.13.52) ] ||
+ skip "no atime update on old OST"
+ if [ "$ost1_FSTYPE" != ldiskfs ]; then
+ skip_env "ldiskfs only test"
+ fi
+
+ local saved_adiff
+ saved_adiff=$(do_facet ost1 \
+ lctl get_param -n obdfilter.*OST0000.atime_diff)
+ stack_trap "do_facet ost1 \
+ lctl set_param obdfilter.*.atime_diff=$saved_adiff"
+
+ do_facet ost1 "lctl set_param obdfilter.*.atime_diff=5"
+
+ $LFS setstripe -i 0 $DIR/$tfile
+ dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 ||
+ error "can't write initial file"
+ cancel_lru_locks osc
+
+ # exceed atime_diff and access file
+ sleep 6
+ dd if=$DIR/$tfile of=/dev/null || error "can't udpate atime"
+
+ local atime_cli=$(stat -c %X $DIR/$tfile)
+ echo "client atime: $atime_cli"
+ # allow atime update to be written to device
+ do_facet ost1 "$LCTL set_param -n osd*.*OST*.force_sync 1"
+ sleep 5
+
+ local ostdev=$(ostdevname 1)
+ local fid=($(lfs getstripe -y $DIR/$tfile |
+ awk '/l_fid:/ { print $2 }' | tr ':' ' '))
+ local objpath="O/0/d$((${fid[1]} % 32))/$((${fid[1]}))"
+ local cmd="debugfs -c -R \\\"stat $objpath\\\" $ostdev"
+
+ echo "OST atime: $(do_facet ost1 "$cmd" |& grep atime)"
+ local atime_ost=$(do_facet ost1 "$cmd" |&
+ awk -F'[: ]' '/atime:/ { print $4 }')
+ (( atime_cli == atime_ost )) ||
+ error "atime on client $atime_cli != ost $atime_ost"
+}
+run_test 39r "lazy atime update on OST"
test_39q() { # LU-8041
local testdir=$DIR/$tdir
}
run_test 56ra "check lfs find -size -lazy works for data on OSTs"
+test_56rb() {
+ local dir=$DIR/$tdir
+ local tmp=$TMP/$tfile.log
+ local mdt_idx;
+
+ test_mkdir -p $dir || error "failed to mkdir $dir"
+ $LFS setstripe -c 1 -i 0 $dir/$tfile ||
+ error "failed to setstripe $dir/$tfile"
+ dd if=/dev/zero of=$dir/$tfile bs=1M count=1
+
+ stack_trap "rm -f $tmp" EXIT
+ $LFS find --size +100K --ost 0 $dir 2>&1 | tee $tmp
+ [ -z "$(cat $tmp | grep "obd_uuid: ")" ] ||
+ error "failed to find --size +100K --ost 0 $dir"
+ $LFS find --size +100K --mdt $mdt_idx $dir 2>&1 | tee $tmp
+ [ -z "$(cat $tmp | grep "obd_uuid: ")" ] ||
+ error "failed to find --size +100K --mdt $mdt_idx $dir"
+}
+run_test 56rb "check lfs find --size --ost/--mdt works"
+
test_56s() { # LU-611 #LU-9369
[[ $OSTCOUNT -lt 2 ]] && skip_env "need at least 2 OSTs"
test_64a () {
[ $PARALLEL == "yes" ] && skip "skip parallel run"
- df $DIR
- lctl get_param -n osc.*[oO][sS][cC][_-]*.cur* | grep "[0-9]"
+ lfs df $DIR
+ lctl get_param osc.*[oO][sS][cC][_-]*.cur* | grep "=[1-9]"
}
run_test 64a "verify filter grant calculations (in kernel) ====="
[ $PARALLEL == "yes" ] && skip "skip parallel run"
local file=$DIR/$tfile
- local sz_MB=${FILESIZE_101d:-500}
+ local sz_MB=${FILESIZE_101d:-80}
local ra_MB=${READAHEAD_MB:-40}
local free_MB=$(($(df -P $DIR | tail -n 1 | awk '{ print $4 }') / 1024))
$LCTL get_param -n llite.*.max_read_ahead_mb
echo Reading the test file $file with read-ahead disabled
- local raOFF=$(do_and_time "dd if=$file of=/dev/null bs=1M count=$sz_MB")
+ local sz_KB=$((sz_MB * 1024 / 4))
+ local raOFF=$(do_and_time "dd if=$file of=/dev/null bs=4k count=$sz_KB")
echo Cancel LRU locks on lustre client to flush the client cache
cancel_lru_locks osc
$LCTL set_param -n llite.*.max_read_ahead_mb=$ra_MB
echo Reading the test file $file with read-ahead enabled
- local raON=$(do_and_time "dd if=$file of=/dev/null bs=1M count=$sz_MB")
+ local raON=$(do_and_time "dd if=$file of=/dev/null bs=4k count=$sz_KB")
echo "read-ahead disabled time read $raOFF"
- echo "read-ahead enabled time read $raON"
+ echo "read-ahead enabled time read $raON"
rm -f $file
wait_delete_completed
}
run_test 101h "Readahead should cover current read window"
+test_101i() {
+ dd if=/dev/zero of=$DIR/$tfile bs=1M count=10 ||
+ error "dd 10M file failed"
+
+ local max_per_file_mb=$($LCTL get_param -n \
+ llite.*.max_read_ahead_per_file_mb 2>/dev/null)
+ cancel_lru_locks osc
+ stack_trap "$LCTL set_param llite.*.max_read_ahead_per_file_mb=$max_per_file_mb"
+ $LCTL set_param llite.*.max_read_ahead_per_file_mb=1 ||
+ error "set max_read_ahead_per_file_mb to 1 failed"
+
+ echo "Reset readahead stats"
+ $LCTL set_param llite.*.read_ahead_stats=0
+
+ dd if=$DIR/$tfile of=/dev/null bs=2M
+
+ $LCTL get_param llite.*.read_ahead_stats
+ local miss=$($LCTL get_param -n llite.*.read_ahead_stats |
+ awk '/misses/ { print $2 }')
+ [ $miss -eq 5 ] || error "expected misses 5 but got $miss"
+ rm -f $DIR/$tfile
+}
+run_test 101i "allow current readahead to exceed reservation"
+
+test_101j() {
+ $LFS setstripe -i 0 -c 1 $DIR/$tfile ||
+ error "setstripe $DIR/$tfile failed"
+ local file_size=$((1048576 * 16))
+ local old_ra=$($LCTL get_param -n llite.*.max_read_ahead_mb | head -n 1)
+ stack_trap "$LCTL set_param -n llite.*.max_read_ahead_mb $old_ra" EXIT
+
+ echo Disable read-ahead
+ $LCTL set_param -n llite.*.max_read_ahead_mb=0
+
+ dd if=/dev/zero of=$DIR/$tfile bs=1M count=$(($file_size / 1048576))
+ for blk in $PAGE_SIZE 1048576 $file_size; do
+ cancel_lru_locks osc
+ echo "Reset readahead stats"
+ $LCTL set_param -n llite.*.read_ahead_stats=0
+ local count=$(($file_size / $blk))
+ dd if=$DIR/$tfile bs=$blk count=$count of=/dev/null
+ local miss=$($LCTL get_param -n llite.*.read_ahead_stats |
+ get_named_value 'failed to fast read' |
+ cut -d" " -f1 | calc_total)
+ $LCTL get_param -n llite.*.read_ahead_stats
+ [ $miss -eq $count ] || error "expected $count got $miss"
+ done
+
+ rm -f $p $DIR/$tfile
+}
+run_test 101j "A complete read block should be submitted when no RA"
+
setup_test102() {
test_mkdir $DIR/$tdir
chown $RUNAS_ID $DIR/$tdir
fi
if [ $facet_ver -ge $(version_code 2.5.54) ]; then
do_facet $facet "$LCTL list_param -R '*' | grep '=' |
- tr -d= | egrep -v 'force_lbug|changelog_mask' |
+ tr -d = | egrep -v 'force_lbug|changelog_mask' |
xargs badarea_io" ||
error_133 "$facet badarea_io failed"
else
local i
# generate some changelog records to accumulate on each MDT
- test_mkdir -c $MDSCOUNT $DIR/$tdir || error "test_mkdir $tdir failed"
+ # use fnv1a because created files should be evenly distributed
+ test_mkdir -c $MDSCOUNT -H fnv_1a_64 $DIR/$tdir ||
+ error "test_mkdir $tdir failed"
log "$(date +%s): creating first files"
createmany -m $DIR/$tdir/$tfile $((MDSCOUNT * 2)) ||
error "create $DIR/$tdir/$tfile failed"
local i
# generate some changelog records to accumulate on each MDT
- test_mkdir -c $MDSCOUNT $DIR/$tdir || error "mkdir $tdir failed"
+ # use fnv1a because created files should be evenly distributed
+ test_mkdir -c $MDSCOUNT -H fnv_1a_64 $DIR/$tdir ||
+ error "mkdir $tdir failed"
createmany -m $DIR/$tdir/$tfile $((MDSCOUNT * 2)) ||
error "create $DIR/$tdir/$tfile failed"
local i
# generate some changelog records to accumulate on each MDT
- test_mkdir -c $MDSCOUNT $DIR/$tdir || error "test_mkdir $tdir failed"
+ # use fnv1a because created files should be evenly distributed
+ test_mkdir -c $MDSCOUNT -H fnv_1a_64 $DIR/$tdir ||
+ error "test_mkdir $tdir failed"
createmany -m $DIR/$tdir/$tfile $((MDSCOUNT * 2)) ||
error "create $DIR/$tdir/$tfile failed"
changelog_register || error "first changelog_register failed"
# generate some changelog records to accumulate on each MDT
- test_mkdir -c $MDSCOUNT $DIR/$tdir || error "mkdir $tdir failed"
+ # use fnv1a because created files should be evenly distributed
+ test_mkdir -c $MDSCOUNT -H fnv_1a_64 $DIR/$tdir ||
+ error "mkdir $tdir failed"
createmany -m $DIR/$tdir/$tfile $((MDSCOUNT * 2)) ||
error "create $DIR/$tdir/$tfile failed"
stack_trap "changelog_deregister" EXIT
# generate some changelog
- test_mkdir -c $MDSCOUNT $DIR/$tdir || error "mkdir $tdir failed"
+ # use fnv1a because created files should be evenly distributed
+ test_mkdir -c $MDSCOUNT -H fnv_1a_64 $DIR/$tdir ||
+ error "mkdir $tdir failed"
createmany -m $DIR/$tdir/${tfile}bis $((MDSCOUNT * 2)) ||
error "create $DIR/$tdir/${tfile}bis failed"
error "User $cl_user not found in changelog_users"
printf 'clear:'$cl_user':0' >&3
-
}
run_test 160j "client can be umounted while its chanangelog is being used"
ln -s $migrate_dir/$tfile $migrate_dir/${tfile}_ln
ln -s $other_dir/$tfile $migrate_dir/${tfile}_ln_other
+ local len
+ local lnktgt
+
+ # inline symlink
+ for len in 58 59 60; do
+ lnktgt=$(str_repeat 'l' $len)
+ touch $migrate_dir/$lnktgt
+ ln -s $lnktgt $migrate_dir/${len}char_ln
+ done
+
+ # PATH_MAX
+ for len in 4094 4095; do
+ lnktgt=$(str_repeat 'l' $len)
+ ln -s $lnktgt $migrate_dir/${len}char_ln
+ done
+
+ # NAME_MAX
+ for len in 254 255; do
+ touch $migrate_dir/$(str_repeat 'l' $len)
+ done
+
$LFS migrate -m $MDTIDX $migrate_dir ||
error "fails on migrating remote dir to MDT1"
for ((i = 0; i < 10; i++)); do
for file in $(find $migrate_dir/dir_${i}); do
mdt_index=$($LFS getstripe -m $file)
- [ $mdt_index == $MDTIDX ] ||
+ # broken symlink getstripe will fail
+ [ $mdt_index -ne $MDTIDX ] && stat -L $file &&
error "$file is not on MDT${MDTIDX}"
done
done
echo "migrate back to MDT0, checking.."
for file in $(find $migrate_dir); do
mdt_index=$($LFS getstripe -m $file)
- [ $mdt_index == $MDTIDX ] ||
+ [ $mdt_index -ne $MDTIDX ] && stat -L $file &&
error "$file is not on MDT${MDTIDX}"
done
old_count=$((MDSCOUNT - old_index))
new_index=$((RANDOM % MDSCOUNT))
new_count=$((MDSCOUNT - new_index))
- new_hash="all_char"
+ new_hash=1 # for all_char
[ $old_count -gt 1 ] && old_count=$((old_count - RANDOM % old_count))
[ $new_count -gt 1 ] && new_count=$((new_count - RANDOM % new_count))
}
run_test 230m "xattrs not changed after dir migration"
+test_230n() {
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
+ [[ $MDS1_VERSION -ge $(version_code 2.13.53) ]] ||
+ skip "Need MDS version at least 2.13.53"
+
+ $LFS mkdir -i 0 $DIR/$tdir || error "mkdir $tdir failed"
+ cat /etc/hosts > $DIR/$tdir/$tfile
+ $LFS mirror extend -N1 $DIR/$tdir/$tfile || error "Mirroring failed"
+ $LFS migrate -m 1 $DIR/$tdir || error "Migration failed"
+
+ cmp /etc/hosts $DIR/$tdir/$tfile ||
+ error "File data mismatch after migration"
+}
+run_test 230n "Dir migration with mirrored file"
+
test_231a()
{
# For simplicity this test assumes that max_pages_per_rpc
}
run_test 278 "Race starting MDS between MDTs stop/start"
+test_280() {
+ [ $MGS_VERSION -lt $(version_code 2.13.52) ] &&
+ skip "Need MGS version at least 2.13.52"
+ [ $PARALLEL == "yes" ] && skip "skip parallel run"
+ combined_mgs_mds || skip "needs combined MGS/MDT"
+
+ umount_client $MOUNT
+#define OBD_FAIL_MDS_LLOG_UMOUNT_RACE 0x15e
+ do_facet mgs $LCTL set_param fail_loc=0x8000015e fail_val=0
+
+ mount_client $MOUNT &
+ sleep 1
+ stop mgs || error "stop mgs failed"
+ #for a race mgs would crash
+ start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "start mgs failed"
+ mount_client $MOUNT || error "mount client failed"
+}
+run_test 280 "Race between MGS umount and client llog processing"
+
cleanup_test_300() {
trap 0
umask $SAVE_UMASK
#local striped directory
$LFS setdirstripe -i 0 -c 2 -H all_char $DIR/$tdir/striped_dir ||
error "set striped dir error"
+ #look at the directories for debug purposes
+ ls -l $DIR/$tdir
+ $LFS getdirstripe $DIR/$tdir
+ ls -l $DIR/$tdir/striped_dir
+ $LFS getdirstripe $DIR/$tdir/striped_dir
createmany -o $DIR/$tdir/striped_dir/f 10 ||
error "create 10 files failed"
#remote striped directory
$LFS setdirstripe -i 1 -c 2 $DIR/$tdir/remote_striped_dir ||
error "set striped dir error"
+ #look at the directories for debug purposes
+ ls -l $DIR/$tdir
+ $LFS getdirstripe $DIR/$tdir
+ ls -l $DIR/$tdir/remote_striped_dir
+ $LFS getdirstripe $DIR/$tdir/remote_striped_dir
createmany -o $DIR/$tdir/remote_striped_dir/f 10 ||
error "create 10 files failed"
chown nobody $DIR/$tdir/d
touch $DIR/$tdir/d/file
- $LFS mv -M1 $DIR/$tdir/d || error "lfs mv failed"
+ $LFS mv -m1 $DIR/$tdir/d || error "lfs mv failed"
}
run_test 316 "lfs mv"
error "truncate $tdir/trunc failed"
local bs=1048576
- dd if=/dev/zero of=$DIR/$tdir/single_dd bs=$bs count=1 ||
+ dd if=/dev/zero of=$DIR/$tdir/single_dd bs=$bs count=1 conv=fsync ||
error "write $tfile failed"
# multi-client wirtes
wait ${pids[$i]}
done
- sleep 5
+ do_rpc_nodes "$CLIENTS" cancel_lru_locks osc
+ do_nodes "$CLIENTS" "sync ; sleep 5 ; sync"
$LSOM_SYNC -u $cl_user -m $FSNAME-MDT0000 $MOUNT
check_lsom_data $DIR/$tdir/trunc
check_lsom_data $DIR/$tdir/single_dd
}
run_test 810 "partial page writes on ZFS (LU-11663)"
-test_811() {
- [ $MDS1_VERSION -lt $(version_code 2.11.56) ] &&
- skip "Need MDS version at least 2.11.56"
-
- #define OBD_FAIL_MDS_ORPHAN_DELETE 0x165
- do_facet mds1 $LCTL set_param fail_loc=0x165
- $MULTIOP $DIR/$tfile Ouc || error "multiop failed"
-
- stop mds1
- start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
-
- wait_update_facet mds1 "pgrep orph_.*-MDD | wc -l" "0" ||
- error "MDD orphan cleanup thread not quit"
-}
-run_test 811 "orphan name stub can be cleaned up in startup"
-
test_812a() {
[ $OST1_VERSION -lt $(version_code 2.12.51) ] &&
skip "OST < 2.12.51 doesn't support this fail_loc"
}
run_test 901 "don't leak a mgc lock on client umount"
+# LU-13377
+test_902() {
+ [ $CLIENT_VERSION -lt $(version_code 2.13.52) ] &&
+ skip "client does not have LU-13377 fix"
+ #define OBD_FAIL_LLITE_SHORT_COMMIT 0x1415
+ $LCTL set_param fail_loc=0x1415
+ dd if=/dev/zero of=$DIR/$tfile bs=1M count=1
+ cancel_lru_locks osc
+ rm -f $DIR/$tfile
+}
+run_test 902 "test short write doesn't hang lustre"
+
complete $SECONDS
[ -f $EXT2_DEV ] && rm $EXT2_DEV || true
check_and_cleanup_lustre