#!/bin/bash
-# -*- tab-width: 4; indent-tabs-mode: t; -*-
+# -*- tab-width: 8; indent-tabs-mode: t; -*-
#
# Run select tests by setting ONLY, or as arguments to the script.
# Skip specific tests by setting EXCEPT.
fi
echo "LU-2561 newly created file is same size as directory..."
- run_acl_subtest 2561 || error "LU-2561 test failed"
+ if [ $(facet_fstype $SINGLEMDS) != "zfs" ]; then
+ run_acl_subtest 2561 || error "LU-2561 test failed"
+ else
+ run_acl_subtest 2561_zfs || error "LU-2561 zfs test failed"
+ fi
cd $SAVE_PWD
umask $SAVE_UMASK
cancel_lru_locks osc
stat $DIR/$tdir > /dev/null
- can1=$(lctl get_param -n ldlm.services.ldlm_canceld.stats |
- awk '/ldlm_cancel/ {print $2}')
- blk1=$(lctl get_param -n ldlm.services.ldlm_cbd.stats |
- awk '/ldlm_bl_callback/ {print $2}')
+ can1=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk1=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
test_mkdir -c1 $DIR/$tdir/d1
- can2=$(lctl get_param -n ldlm.services.ldlm_canceld.stats |
- awk '/ldlm_cancel/ {print $2}')
- blk2=$(lctl get_param -n ldlm.services.ldlm_cbd.stats |
- awk '/ldlm_bl_callback/ {print $2}')
- [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
- [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
- lru_resize_enable mdc
- lru_resize_enable osc
+ can2=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk2=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
+ [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
+ [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
+ lru_resize_enable mdc
+ lru_resize_enable osc
}
run_test 120a "Early Lock Cancel: mkdir test"
lru_resize_disable osc
cancel_lru_locks mdc
stat $DIR/$tdir > /dev/null
- can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'`
- blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
- touch $DIR/$tdir/f1
- can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'`
- blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
- [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
- [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
- lru_resize_enable mdc
- lru_resize_enable osc
+ can1=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk1=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
+ touch $DIR/$tdir/f1
+ can2=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk2=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
+ [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
+ [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
+ lru_resize_enable mdc
+ lru_resize_enable osc
}
run_test 120b "Early Lock Cancel: create test"
lru_resize_disable osc
test_mkdir -p -c1 $DIR/$tdir/d1
test_mkdir -p -c1 $DIR/$tdir/d2
- touch $DIR/$tdir/d1/f1
- cancel_lru_locks mdc
- stat $DIR/$tdir/d1 $DIR/$tdir/d2 $DIR/$tdir/d1/f1 > /dev/null
- can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'`
- blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
- ln $DIR/$tdir/d1/f1 $DIR/$tdir/d2/f2
- can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'`
- blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
- [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
- [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
- lru_resize_enable mdc
- lru_resize_enable osc
+ touch $DIR/$tdir/d1/f1
+ cancel_lru_locks mdc
+ stat $DIR/$tdir/d1 $DIR/$tdir/d2 $DIR/$tdir/d1/f1 > /dev/null
+ can1=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk1=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
+ ln $DIR/$tdir/d1/f1 $DIR/$tdir/d2/f2
+ can2=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk2=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
+ [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
+ [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
+ lru_resize_enable mdc
+ lru_resize_enable osc
}
run_test 120c "Early Lock Cancel: link test"
test_mkdir -p -c1 $DIR/$tdir
[ -z "$(lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel)" ] && \
skip "no early lock cancel on server" && return 0
- lru_resize_disable mdc
- lru_resize_disable osc
- touch $DIR/$tdir
- cancel_lru_locks mdc
- stat $DIR/$tdir > /dev/null
- can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'`
- blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
- chmod a+x $DIR/$tdir
- can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'`
- blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
- [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
- [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
- lru_resize_enable mdc
- lru_resize_enable osc
+ lru_resize_disable mdc
+ lru_resize_disable osc
+ touch $DIR/$tdir
+ cancel_lru_locks mdc
+ stat $DIR/$tdir > /dev/null
+ can1=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk1=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
+ chmod a+x $DIR/$tdir
+ can2=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk2=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
+ [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
+ [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
+ lru_resize_enable mdc
+ lru_resize_enable osc
}
run_test 120d "Early Lock Cancel: setattr test"
cancel_lru_locks osc
dd if=$DIR/$tdir/f1 of=/dev/null
stat $DIR/$tdir $DIR/$tdir/f1 > /dev/null
- can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats |
- awk '/ldlm_cancel/ {print $2}'`
- blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats |
- awk '/ldlm_bl_callback/ {print $2}'`
- unlink $DIR/$tdir/f1
- can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats |
- awk '/ldlm_cancel/ {print $2}'`
- blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats |
- awk '/ldlm_bl_callback/ {print $2}'`
- [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
- [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
- lru_resize_enable mdc
- lru_resize_enable osc
+ can1=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk1=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
+ unlink $DIR/$tdir/f1
+ can2=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk2=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
+ [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
+ [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
+ lru_resize_enable mdc
+ lru_resize_enable osc
}
run_test 120e "Early Lock Cancel: unlink test"
dd if=$DIR/$tdir/d1/f1 of=/dev/null
dd if=$DIR/$tdir/d2/f2 of=/dev/null
stat $DIR/$tdir/d1 $DIR/$tdir/d2 $DIR/$tdir/d1/f1 $DIR/$tdir/d2/f2 > /dev/null
- can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats |
- awk '/ldlm_cancel/ {print $2}'`
- blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats |
- awk '/ldlm_bl_callback/ {print $2}'`
- mv $DIR/$tdir/d1/f1 $DIR/$tdir/d2/f2
- can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats |
- awk '/ldlm_cancel/ {print $2}'`
- blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats |
- awk '/ldlm_bl_callback/ {print $2}'`
- [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
- [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
- lru_resize_enable mdc
- lru_resize_enable osc
+ can1=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk1=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
+ mv $DIR/$tdir/d1/f1 $DIR/$tdir/d2/f2
+ can2=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk2=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
+ [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
+ [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
+ lru_resize_enable mdc
+ lru_resize_enable osc
}
run_test 120f "Early Lock Cancel: rename test"
cancel_lru_locks osc
t0=`date +%s`
- can0=`lctl get_param -n ldlm.services.ldlm_canceld.stats |
- awk '/ldlm_cancel/ {print $2}'`
- blk0=`lctl get_param -n ldlm.services.ldlm_cbd.stats |
- awk '/ldlm_bl_callback/ {print $2}'`
- createmany -o $DIR/$tdir/f $count
- sync
- can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats |
- awk '/ldlm_cancel/ {print $2}'`
- blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats |
- awk '/ldlm_bl_callback/ {print $2}'`
- t1=`date +%s`
- echo total: $((can1-can0)) cancels, $((blk1-blk0)) blockings
- echo rm $count files
- rm -r $DIR/$tdir
- sync
- can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats |
- awk '/ldlm_cancel/ {print $2}'`
- blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats |
- awk '/ldlm_bl_callback/ {print $2}'`
- t2=`date +%s`
- echo total: $count removes in $((t2-t1))
- echo total: $((can2-can1)) cancels, $((blk2-blk1)) blockings
- sleep 2
- # wait for commitment of removal
- lru_resize_enable mdc
- lru_resize_enable osc
+ can0=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk0=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
+ createmany -o $DIR/$tdir/f $count
+ sync
+ can1=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk1=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
+ t1=$(date +%s)
+ echo total: $((can1-can0)) cancels, $((blk1-blk0)) blockings
+ echo rm $count files
+ rm -r $DIR/$tdir
+ sync
+ can2=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n ldlm.services.ldlm_canceld.stats" |
+ awk '/ldlm_cancel/ {print $2}')
+ blk2=$($LCTL get_param -n ldlm.services.ldlm_cbd.stats |
+ awk '/ldlm_bl_callback/ {print $2}')
+ t2=$(date +%s)
+ echo total: $count removes in $((t2-t1))
+ echo total: $((can2-can1)) cancels, $((blk2-blk1)) blockings
+ sleep 2
+ # wait for commitment of removal
+ lru_resize_enable mdc
+ lru_resize_enable osc
}
run_test 120g "Early Lock Cancel: performance test"
}
run_test 160b "Verify that very long rename doesn't crash in changelog"
+test_160c() {
+ local rc=0
+ [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+
+ # Registration step
+ local USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 \
+ changelog_register -n)
+
+ rm -rf $DIR/$tdir
+ mkdir -p $DIR/$tdir
+ $MCREATE $DIR/$tdir/foo_160c
+ changelog_chmask "TRUNC"
+ $TRUNCATE $DIR/$tdir/foo_160c 200
+ changelog_chmask "TRUNC"
+ $TRUNCATE $DIR/$tdir/foo_160c 199
+ $LFS changelog $MDT0
+ TRUNCS=$($LFS changelog $MDT0 | tail -5 | grep -c "TRUNC")
+ [ $TRUNCS -eq 1 ] || err17935 "TRUNC changelog mask count $TRUNCS != 1"
+ $LFS changelog_clear $MDT0 $USER 0
+
+ # Deregistration step
+ echo "deregistering $USER"
+ do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister $USER
+}
+run_test 160c "verify that changelog log catch the truncate event"
+
test_161a() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
test_mkdir -p -c1 $DIR/$tdir
}
run_test 237 "Verify name_to_handle_at/open_by_handle_at syscalls"
+# LU-4659 linkea consistency
+test_238() {
+ touch $DIR/$tfile
+ ln $DIR/$tfile $DIR/$tfile.lnk
+ touch $DIR/$tfile.new
+ mv $DIR/$tfile.new $DIR/$tfile
+ local fid1=$(lfs path2fid $DIR/$tfile)
+ local fid2=$(lfs path2fid $DIR/$tfile.lnk)
+ local path1=$(lfs fid2path $FSNAME $fid1)
+ [ $tfile == $path1 ] || error "linkea inconsistent: $tfile $fid1 $path1"
+ local path2=$(lfs fid2path $FSNAME $fid2)
+ [ $tfile.lnk == $path2 ] ||
+ error "linkea inconsistent: $tfile.lnk $fid2 $path2!"
+ rm -f $DIR/$tfile*
+}
+run_test 238 "Verify linkea consistency"
+
test_striped_dir() {
local mdt_index=$1
local stripe_count