Whamcloud - gitweb
LU-4131 mdd: Changelog not logging file truncate.
[fs/lustre-release.git] / lustre / tests / sanity.sh
index ff6a319..7a430d0 100644 (file)
@@ -9779,6 +9779,32 @@ test_160b() { # LU-3587
 }
 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
@@ -12246,6 +12272,23 @@ test_237() {
 }
 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