public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Tsvetkov <alexander.tsvetkov@oracle.com>
To: xfs@oss.sgi.com, Dave Chinner <david@fromorbit.com>
Subject: [PATCH] xfs: log record crc mismatch test
Date: Mon, 27 Apr 2015 18:25:57 +0300	[thread overview]
Message-ID: <553E5505.4070804@oracle.com> (raw)

Added new test case for simulation of V5 filesystem
log crc record corruption using of external log.

Signed-off-by: Alexander Tsvetkov <alexander.tsvetkov@oracle.com>
---
  tests/xfs/005     | 28 ++++++++++++++++++++++++++--
  tests/xfs/005.out |  3 +++
  2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/tests/xfs/005 b/tests/xfs/005
index fade4bb..ba0dcbb 100755
--- a/tests/xfs/005
+++ b/tests/xfs/005
@@ -1,7 +1,7 @@
  #! /bin/bash
  # FS QA Test No. 005
  #
-# Test that a bad crc on a primary V5 superblock will fail the mount
+# Test that a bad crc on a V5 filesystem will fail the mount
  #
  # 10e6e65 xfs: be more forgiving of a v4 secondary sb w/ junk in v5 fields
  # inadvertently caused primary SB CRC failures to not error out, this
@@ -55,10 +55,12 @@ _supported_os Linux

  _require_scratch_nocheck
  _require_xfs_mkfs_crc
+_require_logdev
+logsize=2560

  rm -f $seqres.full

-_scratch_mkfs_xfs -m crc=1 >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_xfs -m crc=1 -lsize=${logsize}b >> $seqres.full 2>&1 || 
_fail "mkfs failed"

  # Zap the crc.  xfs_db updates the CRC post-write, so poke it directly
  $XFS_IO_PROG -c "pwrite 224 4" -c fsync $SCRATCH_DEV | _filter_xfs_io
@@ -66,6 +68,28 @@ $XFS_IO_PROG -c "pwrite 224 4" -c fsync $SCRATCH_DEV 
| _filter_xfs_io
  # should FAIL, the crc is bad; golden output contains mount failure
  _scratch_mount 2>&1 | filter_mount

+_scratch_unmount &> /dev/null
+_scratch_mkfs_xfs -m crc=1 -lsize=${logsize}b  >> $seqres.full 2>&1 || 
_fail "mkfs failed"
+_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.
+$XFS_IO_PROG -c "pwrite 5000 5" $SCRATCH_LOGDEV | _filter_xfs_io
+
+# should FAIL, log record crc is bad; golden output contains mount failure
+_scratch_mount 2>&1 | filter_mount
+
  # success, all done
  status=0
  exit
diff --git a/tests/xfs/005.out b/tests/xfs/005.out
index 13d0125..8907301 100644
--- a/tests/xfs/005.out
+++ b/tests/xfs/005.out
@@ -2,3 +2,6 @@ QA output created by 005
  wrote 4/4 bytes at offset 224
  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 5000
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+mount: Structure needs cleaning
-- 
1.9.3

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

             reply	other threads:[~2015-04-27 15:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 15:25 Alexander Tsvetkov [this message]
2015-04-27 16:43 ` [PATCH] xfs: log record crc mismatch test Eric Sandeen
2015-05-13 14:52   ` [PATCH v2] " Alexander Tsvetkov
2015-04-27 23:48 ` [PATCH] " Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=553E5505.4070804@oracle.com \
    --to=alexander.tsvetkov@oracle.com \
    --cc=david@fromorbit.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox