All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: guaneryu@gmail.com, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH 2/5] xfs/123: fix remote symlink block size calculation
Date: Tue, 18 Dec 2018 12:35:57 -0800	[thread overview]
Message-ID: <154516535699.31115.15359236623997726880.stgit@magnolia> (raw)
In-Reply-To: <154516534392.31115.7010578395334646479.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

In this test we try to create a remote symlink block by creating a
symlink target buffer large enough to exceed the size of an inode.
Unfortunately we don't use the correct block size or symlink header
size, which on a 1k block filesystem causes there to be two remote
blocks.  This causes crc verification errors in xfs_db (because it's too
dumb to load both blocks as one like the kernel does) which we don't
care about because we're about to corrupt the block anyway.

So, fix the block size calculation so that we end up with one block.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/123 |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)


diff --git a/tests/xfs/123 b/tests/xfs/123
index 8a494ef9..f45e94bf 100755
--- a/tests/xfs/123
+++ b/tests/xfs/123
@@ -46,11 +46,12 @@ _scratch_mkfs_xfs > /dev/null
 
 echo "+ mount fs image"
 _scratch_mount
-blksz=1000
+blksz=1024
 
 echo "+ make some files"
 echo "file contents: moo" > "${SCRATCH_MNT}/x"
-str="$(perl -e "print './' x $(( (blksz / 2) - 16));")x"
+reps=$(( (blksz - (56 + 1)) / 2 ))
+str="$(perl -e "print './' x $reps;")x"
 (cd $SCRATCH_MNT; ln -s "${str}" "long_symlink")
 cat "${SCRATCH_MNT}/long_symlink"
 inode="$(stat -c '%i' "${SCRATCH_MNT}/long_symlink")"
@@ -60,7 +61,7 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ corrupt image"
-_scratch_xfs_db -x -c "inode ${inode}" -c "dblock 0" -c "stack" -c "blocktrash -x 32 -o 256 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
+_scratch_xfs_db -x -c "inode ${inode}" -c "dblock 0" -c "stack" -c "blocktrash -x 32 -o 256 -y $((blksz * 4)) -z ${FUZZ_ARGS}" >> $seqres.full
 
 echo "+ mount image"
 if _try_scratch_mount >> $seqres.full 2>&1; then

  parent reply	other threads:[~2018-12-18 20:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-18 20:35 [PATCH 0/5] fstests: fix various problems Darrick J. Wong
2018-12-18 20:35 ` [PATCH 1/5] xfs/111: fix golden output Darrick J. Wong
2018-12-18 20:35 ` Darrick J. Wong [this message]
2018-12-18 20:36 ` [PATCH 3/5] generic/050: fix ro blockdev mount of xfs with quota Darrick J. Wong
2018-12-18 20:36 ` [PATCH 4/5] xfs: look for stringified constants in ftrace formats Darrick J. Wong
2018-12-18 20:36 ` [PATCH 5/5] xfs: filter out mount options that don't work on v4 filesystems Darrick J. Wong

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=154516535699.31115.15359236623997726880.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.