new file mode 100755
@@ -0,0 +1,110 @@
+#! /bin/bash
+# FS QA Test No. 306
+#
+# Test that bad crc on a V5 log record will fail the mount
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ cd /
+ rm -f $tmp.*
+}
+
+filter_mount()
+{
+ sed -e "s/mount .* failed: //"
+}
+
+filter_io()
+{
+ sed -e "s/at offset .*/at offset XXX/"
+}
+
+# $1 - log start offset
+# $2 - log device
+do_test()
+{
+ off=$1
+ dev=$2
+
+ _scratch_unmount >/dev/null 2>&1
+ _scratch_mount >> $seqres.full 2>&1 || _fail "mount failed"
+
+ # Run filesytem exercising for some time
+ param="-f link=10 -f creat=10 -f mkdir=10 -f truncate=5 -f symlink=10"
+ $FSSTRESS_PROG $param -s 1 $FSSTRESS_AVOID -n 1000 -d $SCRATCH_MNT
&> /dev/null
+ sleep 3
+
+ # Shutdown filesystem and unmount
+ src/godown -v $SCRATCH_MNT >> $seqres.full
+ killall -q fsstress
+ wait
+ sleep 3
+ _scratch_unmount
+
+ # Zap log record crc
+ off=$((off + 5000))
+ $XFS_IO_PROG -c "pwrite $off 5" $dev | _filter_xfs_io | filter_io
+
+ # should FAIL, log record crc is bad; golden output contains mount
failure
+ _scratch_mount 2>&1 | filter_mount
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+_supported_fs xfs
+_supported_os Linux
+
+_require_scratch_nocheck
+_require_xfs_mkfs_crc
+_require_logdev
+
+rm -f $seqres.full
+fssize=$((32 * 1024 * 1024))
+MKFS_OPTIONS="-m crc=1 $MKFS_OPTIONS"
+_scratch_mkfs_sized $fssize 2> /dev/null | _filter_mkfs 2> $tmp.mkfs >
/dev/null
+. $tmp.mkfs
+
+# internal log corruption
+unset USE_EXTERNAL
+_scratch_mkfs_sized $fssize >> $seqres.full 2>&1 || _fail "mkfs failed"
+logstart=$($XFS_DB_PROG -c "sb 0" -c "print" $SCRATCH_DEV | grep
logstart | cut -f3 -d' ')
+offset=$((logstart * lbsize))
+do_test $offset $SCRATCH_DEV
+
+# external log corruption
+USE_EXTERNAL="yes"
+_scratch_mkfs_sized $fssize >> $seqres.full 2>&1 || _fail "mkfs failed"
+do_test 0 $SCRATCH_LOGDEV
+
+# success, all done
+status=0
+exit
new file mode 100644
@@ -0,0 +1,7 @@
+QA output created by 306
+wrote 5/5 bytes at offset XXX
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+mount: Structure needs cleaning
+wrote 5/5 bytes at offset XXX
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+mount: Structure needs cleaning
@@ -191,3 +191,4 @@
303 auto quick quota
304 auto quick quota
305 auto quota
+306 auto quick