* [PATCH 5/9] common/fuzzy: move fuzzing helper functions here
2016-11-05 0:17 [PATCH v2 0/9] xfstests: online scrub/repair support Darrick J. Wong
@ 2016-11-05 0:17 ` Darrick J. Wong
0 siblings, 0 replies; 22+ messages in thread
From: Darrick J. Wong @ 2016-11-05 0:17 UTC (permalink / raw)
To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests
Move some fuzzing helper functions into a new common/fuzzy file.
We'll add a lot more fuzzing helpers in subsequent patches.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
common/fuzzy | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
common/populate | 36 ------------------------
tests/ext4/006 | 1 +
tests/xfs/083 | 1 +
4 files changed, 85 insertions(+), 36 deletions(-)
create mode 100644 common/fuzzy
diff --git a/common/fuzzy b/common/fuzzy
new file mode 100644
index 0000000..20f1d29
--- /dev/null
+++ b/common/fuzzy
@@ -0,0 +1,83 @@
+##/bin/bash
+
+# Routines for fuzzing and scrubbing a filesystem.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016 Oracle. 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will 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 to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+#
+# Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
+# Mountain View, CA 94043, USA, or: http://www.sgi.com
+#-----------------------------------------------------------------------
+
+# Modify various files after a fuzzing operation
+_scratch_fuzz_modify() {
+ nr="$1"
+
+ test -z "${nr}" && nr=50000
+ echo "+++ touch ${nr} files"
+ blk_sz=$(stat -f -c '%s' ${SCRATCH_MNT})
+ $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${blk_sz}" "/tmp/afile" > /dev/null
+ date="$(date)"
+ find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n "${nr}" | while read f; do
+ setfattr -n "user.date" -v "${date}" "$f"
+ cat "/tmp/afile" >> "$f"
+ mv "$f" "$f.longer"
+ done
+ sync
+ rm -rf "/tmp/afile"
+
+ echo "+++ create files"
+ mkdir -p "${SCRATCH_MNT}/test.moo"
+ $XFS_IO_PROG -f -c 'pwrite -S 0x80 0 65536' "${SCRATCH_MNT}/test.moo/urk"
+ sync
+
+ echo "+++ remove files"
+ rm -rf "${SCRATCH_MNT}/test.moo"
+}
+
+# Try to access files after fuzzing
+_scratch_fuzz_test() {
+ echo "+++ ls -laR" >> $seqres.full
+ ls -laR "${SCRATCH_MNT}/test.1/" >/dev/null 2>&1
+
+ echo "+++ cat files" >> $seqres.full
+ (find "${SCRATCH_MNT}/test.1/" -type f -size -1048576k -print0 | xargs -0 cat) >/dev/null 2>&1
+}
+
+# Do we have an online scrub program?
+_require_scrub() {
+ case "${FSTYP}" in
+ "xfs"|"ext4")
+ test -x $XFS_SCRUB_PROG || _notrun "xfs_scrub not found"
+ ;;
+ *)
+ _notrun "No online scrub program for ${FSTYP}."
+ ;;
+ esac
+}
+
+# Scrub the scratch filesystem (online)
+_scratch_scrub() {
+ case "${FSTYP}" in
+ "xfs"|"ext4")
+ $XFS_SCRUB_PROG -d -T -v "$@" $SCRATCH_MNT
+ ;;
+ *)
+ _fail "No online scrub program for ${FSTYP}."
+ ;;
+ esac
+}
diff --git a/common/populate b/common/populate
index d2df121..947d74f 100644
--- a/common/populate
+++ b/common/populate
@@ -599,39 +599,3 @@ _scratch_populate() {
;;
esac
}
-
-# Modify various files after a fuzzing operation
-_scratch_fuzz_modify() {
- nr="$1"
-
- test -z "${nr}" && nr=50000
- echo "+++ touch ${nr} files"
- blk_sz=$(stat -f -c '%s' ${SCRATCH_MNT})
- $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${blk_sz}" "/tmp/afile" > /dev/null
- date="$(date)"
- find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n "${nr}" | while read f; do
- setfattr -n "user.date" -v "${date}" "$f"
- cat "/tmp/afile" >> "$f"
- mv "$f" "$f.longer"
- done
- sync
- rm -rf "/tmp/afile"
-
- echo "+++ create files"
- mkdir -p "${SCRATCH_MNT}/test.moo"
- $XFS_IO_PROG -f -c 'pwrite -S 0x80 0 65536' "${SCRATCH_MNT}/test.moo/urk"
- sync
-
- echo "+++ remove files"
- rm -rf "${SCRATCH_MNT}/test.moo"
-}
-
-# Try to access files after fuzzing
-_scratch_fuzz_test() {
- echo "+++ ls -laR" >> $seqres.full
- ls -laR "${SCRATCH_MNT}/test.1/" >/dev/null 2>&1
-
- echo "+++ cat files" >> $seqres.full
- (find "${SCRATCH_MNT}/test.1/" -type f -size -1048576k -print0 | xargs -0 cat) >/dev/null 2>&1
-}
-
diff --git a/tests/ext4/006 b/tests/ext4/006
index 9662f50..bb9b7e5 100755
--- a/tests/ext4/006
+++ b/tests/ext4/006
@@ -43,6 +43,7 @@ _cleanup()
. ./common/filter
. ./common/attr
. ./common/populate
+. ./common/fuzzy
if [ ! -x "$(which e2fuzz)" ]; then
_notrun "Couldn't find e2fuzz"
diff --git a/tests/xfs/083 b/tests/xfs/083
index 39bd75f..e2b5f82 100755
--- a/tests/xfs/083
+++ b/tests/xfs/083
@@ -43,6 +43,7 @@ _cleanup()
. ./common/filter
. ./common/attr
. ./common/populate
+. ./common/fuzzy
# real QA test starts here
_supported_fs xfs
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 5/9] common/fuzzy: move fuzzing helper functions here
2017-01-05 1:17 [PATCH v4 " Darrick J. Wong
@ 2017-01-05 1:17 ` Darrick J. Wong
2017-01-10 23:32 ` Darrick J. Wong
0 siblings, 1 reply; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-05 1:17 UTC (permalink / raw)
To: eguan, darrick.wong; +Cc: linux-xfs, fstests
Move some fuzzing helper functions into a new common/fuzzy file.
We'll add a lot more fuzzing helpers in subsequent patches.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
common/fuzzy | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
common/populate | 35 -----------------------
tests/ext4/006 | 1 +
tests/xfs/083 | 1 +
4 files changed, 85 insertions(+), 35 deletions(-)
create mode 100644 common/fuzzy
diff --git a/common/fuzzy b/common/fuzzy
new file mode 100644
index 0000000..1cc1d5e
--- /dev/null
+++ b/common/fuzzy
@@ -0,0 +1,83 @@
+##/bin/bash
+
+# Routines for fuzzing and scrubbing a filesystem.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 Oracle. 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will 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 to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+#
+# Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
+# Mountain View, CA 94043, USA, or: http://www.sgi.com
+#-----------------------------------------------------------------------
+
+# Modify various files after a fuzzing operation
+_scratch_fuzz_modify() {
+ nr="$1"
+
+ test -z "${nr}" && nr=50000
+ echo "+++ touch ${nr} files"
+ blk_sz=$(stat -f -c '%s' ${SCRATCH_MNT})
+ $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${blk_sz}" "/tmp/afile" > /dev/null
+ date="$(date)"
+ find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n "${nr}" | while read f; do
+ setfattr -n "user.date" -v "${date}" "$f"
+ cat "/tmp/afile" >> "$f"
+ mv "$f" "$f.longer"
+ done
+ sync
+ rm -rf "/tmp/afile"
+
+ echo "+++ create files"
+ mkdir -p "${SCRATCH_MNT}/test.moo"
+ $XFS_IO_PROG -f -c 'pwrite -S 0x80 0 65536' "${SCRATCH_MNT}/test.moo/urk"
+ sync
+
+ echo "+++ remove files"
+ rm -rf "${SCRATCH_MNT}/test.moo"
+}
+
+# Try to access files after fuzzing
+_scratch_fuzz_test() {
+ echo "+++ ls -laR" >> $seqres.full
+ ls -laR "${SCRATCH_MNT}/test.1/" >/dev/null 2>&1
+
+ echo "+++ cat files" >> $seqres.full
+ (find "${SCRATCH_MNT}/test.1/" -type f -size -1048576k -print0 | xargs -0 cat) >/dev/null 2>&1
+}
+
+# Do we have an online scrub program?
+_require_scrub() {
+ case "${FSTYP}" in
+ "xfs"|"ext4")
+ test -x $XFS_SCRUB_PROG || _notrun "xfs_scrub not found"
+ ;;
+ *)
+ _notrun "No online scrub program for ${FSTYP}."
+ ;;
+ esac
+}
+
+# Scrub the scratch filesystem metadata (online)
+_scratch_scrub() {
+ case "${FSTYP}" in
+ "xfs"|"ext4"|"ext3"|"ext2")
+ $XFS_SCRUB_PROG -d -T -v "$@" $SCRATCH_MNT
+ ;;
+ *)
+ _fail "No online scrub program for ${FSTYP}."
+ ;;
+ esac
+}
diff --git a/common/populate b/common/populate
index 5808bc9..f012173 100644
--- a/common/populate
+++ b/common/populate
@@ -606,41 +606,6 @@ _scratch_populate() {
esac
}
-# Modify various files after a fuzzing operation
-_scratch_fuzz_modify() {
- nr="$1"
-
- test -z "${nr}" && nr=50000
- echo "+++ touch ${nr} files"
- blk_sz=$(stat -f -c '%s' ${SCRATCH_MNT})
- $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${blk_sz}" "/tmp/afile" > /dev/null
- date="$(date)"
- find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n "${nr}" | while read f; do
- setfattr -n "user.date" -v "${date}" "$f"
- cat "/tmp/afile" >> "$f"
- mv "$f" "$f.longer"
- done
- sync
- rm -rf "/tmp/afile"
-
- echo "+++ create files"
- mkdir -p "${SCRATCH_MNT}/test.moo"
- $XFS_IO_PROG -f -c 'pwrite -S 0x80 0 65536' "${SCRATCH_MNT}/test.moo/urk"
- sync
-
- echo "+++ remove files"
- rm -rf "${SCRATCH_MNT}/test.moo"
-}
-
-# Try to access files after fuzzing
-_scratch_fuzz_test() {
- echo "+++ ls -laR" >> $seqres.full
- ls -laR "${SCRATCH_MNT}/test.1/" >/dev/null 2>&1
-
- echo "+++ cat files" >> $seqres.full
- (find "${SCRATCH_MNT}/test.1/" -type f -size -1048576k -print0 | xargs -0 cat) >/dev/null 2>&1
-}
-
# Fill a file system by repeatedly creating files in the given folder
# starting with the given file size. Files are reduced in size when
# they can no longer fit until no more files can be created.
diff --git a/tests/ext4/006 b/tests/ext4/006
index 9662f50..bb9b7e5 100755
--- a/tests/ext4/006
+++ b/tests/ext4/006
@@ -43,6 +43,7 @@ _cleanup()
. ./common/filter
. ./common/attr
. ./common/populate
+. ./common/fuzzy
if [ ! -x "$(which e2fuzz)" ]; then
_notrun "Couldn't find e2fuzz"
diff --git a/tests/xfs/083 b/tests/xfs/083
index 39bd75f..e2b5f82 100755
--- a/tests/xfs/083
+++ b/tests/xfs/083
@@ -43,6 +43,7 @@ _cleanup()
. ./common/filter
. ./common/attr
. ./common/populate
+. ./common/fuzzy
# real QA test starts here
_supported_fs xfs
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH 5/9] common/fuzzy: move fuzzing helper functions here
2017-01-05 1:17 ` [PATCH 5/9] common/fuzzy: move fuzzing helper functions here Darrick J. Wong
@ 2017-01-10 23:32 ` Darrick J. Wong
0 siblings, 0 replies; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-10 23:32 UTC (permalink / raw)
To: eguan; +Cc: linux-xfs, fstests
On Wed, Jan 04, 2017 at 05:17:32PM -0800, Darrick J. Wong wrote:
> Move some fuzzing helper functions into a new common/fuzzy file.
> We'll add a lot more fuzzing helpers in subsequent patches.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> common/fuzzy | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> common/populate | 35 -----------------------
> tests/ext4/006 | 1 +
> tests/xfs/083 | 1 +
> 4 files changed, 85 insertions(+), 35 deletions(-)
> create mode 100644 common/fuzzy
>
>
> diff --git a/common/fuzzy b/common/fuzzy
> new file mode 100644
> index 0000000..1cc1d5e
> --- /dev/null
> +++ b/common/fuzzy
> @@ -0,0 +1,83 @@
> +##/bin/bash
> +
> +# Routines for fuzzing and scrubbing a filesystem.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2017 Oracle. 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; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will 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 to the Free Software
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
> +# USA
> +#
> +# Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
> +# Mountain View, CA 94043, USA, or: http://www.sgi.com
SGI isn't on Crittenden Lane anymore -- the site has been taken over by some
flashy startup company, so this should go away.
--D
> +#-----------------------------------------------------------------------
> +
> +# Modify various files after a fuzzing operation
> +_scratch_fuzz_modify() {
> + nr="$1"
> +
> + test -z "${nr}" && nr=50000
> + echo "+++ touch ${nr} files"
> + blk_sz=$(stat -f -c '%s' ${SCRATCH_MNT})
> + $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${blk_sz}" "/tmp/afile" > /dev/null
> + date="$(date)"
> + find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n "${nr}" | while read f; do
> + setfattr -n "user.date" -v "${date}" "$f"
> + cat "/tmp/afile" >> "$f"
> + mv "$f" "$f.longer"
> + done
> + sync
> + rm -rf "/tmp/afile"
> +
> + echo "+++ create files"
> + mkdir -p "${SCRATCH_MNT}/test.moo"
> + $XFS_IO_PROG -f -c 'pwrite -S 0x80 0 65536' "${SCRATCH_MNT}/test.moo/urk"
> + sync
> +
> + echo "+++ remove files"
> + rm -rf "${SCRATCH_MNT}/test.moo"
> +}
> +
> +# Try to access files after fuzzing
> +_scratch_fuzz_test() {
> + echo "+++ ls -laR" >> $seqres.full
> + ls -laR "${SCRATCH_MNT}/test.1/" >/dev/null 2>&1
> +
> + echo "+++ cat files" >> $seqres.full
> + (find "${SCRATCH_MNT}/test.1/" -type f -size -1048576k -print0 | xargs -0 cat) >/dev/null 2>&1
> +}
> +
> +# Do we have an online scrub program?
> +_require_scrub() {
> + case "${FSTYP}" in
> + "xfs"|"ext4")
> + test -x $XFS_SCRUB_PROG || _notrun "xfs_scrub not found"
> + ;;
> + *)
> + _notrun "No online scrub program for ${FSTYP}."
> + ;;
> + esac
> +}
> +
> +# Scrub the scratch filesystem metadata (online)
> +_scratch_scrub() {
> + case "${FSTYP}" in
> + "xfs"|"ext4"|"ext3"|"ext2")
> + $XFS_SCRUB_PROG -d -T -v "$@" $SCRATCH_MNT
> + ;;
> + *)
> + _fail "No online scrub program for ${FSTYP}."
> + ;;
> + esac
> +}
> diff --git a/common/populate b/common/populate
> index 5808bc9..f012173 100644
> --- a/common/populate
> +++ b/common/populate
> @@ -606,41 +606,6 @@ _scratch_populate() {
> esac
> }
>
> -# Modify various files after a fuzzing operation
> -_scratch_fuzz_modify() {
> - nr="$1"
> -
> - test -z "${nr}" && nr=50000
> - echo "+++ touch ${nr} files"
> - blk_sz=$(stat -f -c '%s' ${SCRATCH_MNT})
> - $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${blk_sz}" "/tmp/afile" > /dev/null
> - date="$(date)"
> - find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n "${nr}" | while read f; do
> - setfattr -n "user.date" -v "${date}" "$f"
> - cat "/tmp/afile" >> "$f"
> - mv "$f" "$f.longer"
> - done
> - sync
> - rm -rf "/tmp/afile"
> -
> - echo "+++ create files"
> - mkdir -p "${SCRATCH_MNT}/test.moo"
> - $XFS_IO_PROG -f -c 'pwrite -S 0x80 0 65536' "${SCRATCH_MNT}/test.moo/urk"
> - sync
> -
> - echo "+++ remove files"
> - rm -rf "${SCRATCH_MNT}/test.moo"
> -}
> -
> -# Try to access files after fuzzing
> -_scratch_fuzz_test() {
> - echo "+++ ls -laR" >> $seqres.full
> - ls -laR "${SCRATCH_MNT}/test.1/" >/dev/null 2>&1
> -
> - echo "+++ cat files" >> $seqres.full
> - (find "${SCRATCH_MNT}/test.1/" -type f -size -1048576k -print0 | xargs -0 cat) >/dev/null 2>&1
> -}
> -
> # Fill a file system by repeatedly creating files in the given folder
> # starting with the given file size. Files are reduced in size when
> # they can no longer fit until no more files can be created.
> diff --git a/tests/ext4/006 b/tests/ext4/006
> index 9662f50..bb9b7e5 100755
> --- a/tests/ext4/006
> +++ b/tests/ext4/006
> @@ -43,6 +43,7 @@ _cleanup()
> . ./common/filter
> . ./common/attr
> . ./common/populate
> +. ./common/fuzzy
>
> if [ ! -x "$(which e2fuzz)" ]; then
> _notrun "Couldn't find e2fuzz"
> diff --git a/tests/xfs/083 b/tests/xfs/083
> index 39bd75f..e2b5f82 100755
> --- a/tests/xfs/083
> +++ b/tests/xfs/083
> @@ -43,6 +43,7 @@ _cleanup()
> . ./common/filter
> . ./common/attr
> . ./common/populate
> +. ./common/fuzzy
>
> # real QA test starts here
> _supported_fs xfs
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v5 0/9] xfstests: online scrub/repair support
@ 2017-01-21 8:10 Darrick J. Wong
2017-01-21 8:10 ` [PATCH 1/9] populate: create all types of XFS metadata Darrick J. Wong
` (9 more replies)
0 siblings, 10 replies; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-21 8:10 UTC (permalink / raw)
To: eguan, darrick.wong; +Cc: linux-xfs, fstests
Hi all,
This is the fifth revision of a patchset that adds to XFS userland tools
support for online metadata scrubbing and repair.
The new patches in this series do three things: first, they expand the
filesystem populate commands inside xfstests to be able to create all
types of XFS metadata. Second, they create a bunch of xfs_db wrapper
functions to iterate all fields present in a given metadata object and
fuzz them in various ways. Finally, for each metadata object type there
is a separate test that iteratively fuzzes all fields of that object and
runs it through the mount/scrub/repair loop to see what happens.
If you're going to start using this mess, you probably ought to just
pull from my github trees for kernel[1], xfsprogs[2], and xfstests[3].
The kernel patches in the git trees should apply to 4.10-rc4; xfsprogs
patches to for-next; and xfstest to master.
The patches have survived all auto group xfstests both with scrub-only
mode and also a special debugging mode to xfs_scrub that forces it to
rebuild the metadata structures even if they're not damaged.
This is an extraordinary way to eat your data. Enjoy!
Comments and questions are, as always, welcome.
--D
[1] https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=djwong-devel
[2] https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=djwong-devel
[3] https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=djwong-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 1/9] populate: create all types of XFS metadata
2017-01-21 8:10 [PATCH v5 0/9] xfstests: online scrub/repair support Darrick J. Wong
@ 2017-01-21 8:10 ` Darrick J. Wong
2017-01-21 8:10 ` [PATCH 2/9] populate: add _require_populate_commands to check for tools Darrick J. Wong
` (8 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-21 8:10 UTC (permalink / raw)
To: eguan, darrick.wong; +Cc: linux-xfs, fstests
We have three new metadata types -- rmapbt, rtrmapbt, and refcountbt.
Ensure that we populate the scratch fs with all three.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
common/populate | 97 +++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 87 insertions(+), 10 deletions(-)
diff --git a/common/populate b/common/populate
index df6550d..164fdd3 100644
--- a/common/populate
+++ b/common/populate
@@ -24,6 +24,7 @@
_require_xfs_io_command "falloc"
_require_xfs_io_command "fpunch"
+_require_test_program "punch-alternating"
_require_xfs_db_blocktrash_z_command() {
test "${FSTYP}" = "xfs" || _notrun "cannot run xfs_db on ${FSTYP}"
@@ -97,6 +98,12 @@ _scratch_xfs_populate() {
# Data:
+ # Fill up the root inode chunk
+ echo "+ fill root ino chunk"
+ seq 1 64 | while read f; do
+ $XFS_IO_PROG -f -c "truncate 0" "${SCRATCH_MNT}/dummy${f}"
+ done
+
# Regular files
# - FMT_EXTENTS
echo "+ extents file"
@@ -106,9 +113,7 @@ _scratch_xfs_populate() {
echo "+ btree extents file"
nr="$((blksz * 2 / 16))"
$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((blksz * nr))" "${SCRATCH_MNT}/S_IFREG.FMT_BTREE"
- for i in $(seq 1 2 ${nr}); do
- $XFS_IO_PROG -f -c "fpunch $((i * blksz)) ${blksz}" "${SCRATCH_MNT}/S_IFREG.FMT_BTREE"
- done
+ ./src/punch-alternating "${SCRATCH_MNT}/S_IFREG.FMT_BTREE"
# Directories
# - INLINE
@@ -128,6 +133,7 @@ _scratch_xfs_populate() {
__populate_create_dir "${SCRATCH_MNT}/S_IFDIR.FMT_NODE" "$((16 * dblksz / 40))" true
# - BTREE
+ echo "+ btree dir"
__populate_create_dir "${SCRATCH_MNT}/S_IFDIR.FMT_BTREE" "$((128 * dblksz / 40))" true
# Symlinks
@@ -164,13 +170,13 @@ _scratch_xfs_populate() {
# FMT_EXTENTS with a remote less-than-a-block value
echo "+ attr extents with a remote less-than-a-block value"
touch "${SCRATCH_MNT}/ATTR.FMT_EXTENTS_REMOTE3K"
- $XFS_IO_PROG -f -c "pwrite -S 0x43 0 3k" "${SCRATCH_MNT}/attrvalfile" > /dev/null
+ $XFS_IO_PROG -f -c "pwrite -S 0x43 0 $((blksz - 300))" "${SCRATCH_MNT}/attrvalfile" > /dev/null
attr -q -s user.remotebtreeattrname "${SCRATCH_MNT}/ATTR.FMT_EXTENTS_REMOTE3K" < "${SCRATCH_MNT}/attrvalfile"
# FMT_EXTENTS with a remote block-size value
echo "+ attr extents with a remote one-block value"
touch "${SCRATCH_MNT}/ATTR.FMT_EXTENTS_REMOTE4K"
- $XFS_IO_PROG -f -c "pwrite -S 0x44 0 4k" "${SCRATCH_MNT}/attrvalfile" > /dev/null
+ $XFS_IO_PROG -f -c "pwrite -S 0x44 0 ${blksz}" "${SCRATCH_MNT}/attrvalfile" > /dev/null
attr -q -s user.remotebtreeattrname "${SCRATCH_MNT}/ATTR.FMT_EXTENTS_REMOTE4K" < "${SCRATCH_MNT}/attrvalfile"
rm -rf "${SCRATCH_MNT}/attrvalfile"
@@ -180,10 +186,43 @@ _scratch_xfs_populate() {
$XFS_IO_PROG -f -c 'fsync' "${SCRATCH_MNT}/unused"
rm -rf "${SCRATCH_MNT}/unused"
+ # Free space btree
+ echo "+ freesp btree"
+ nr="$((blksz * 2 / 8))"
+ $XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((blksz * nr))" "${SCRATCH_MNT}/BNOBT"
+ ./src/punch-alternating "${SCRATCH_MNT}/BNOBT"
+
+ # Reverse-mapping btree
+ is_rmapbt="$(xfs_info "${SCRATCH_MNT}" | grep -c 'rmapbt=1')"
+ if [ $is_rmapbt -gt 0 ]; then
+ echo "+ rmapbt btree"
+ nr="$((blksz * 2 / 24))"
+ $XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((blksz * nr))" "${SCRATCH_MNT}/RMAPBT"
+ ./src/punch-alternating "${SCRATCH_MNT}/RMAPBT"
+ fi
+
+ # Realtime Reverse-mapping btree
+ is_rt="$(xfs_info "${SCRATCH_MNT}" | grep -c 'rtextents=[1-9]')"
+ if [ $is_rmapbt -gt 0 ] && [ $is_rt -gt 0 ]; then
+ echo "+ rtrmapbt btree"
+ nr="$((blksz * 2 / 32))"
+ $XFS_IO_PROG -f -R -c "pwrite -S 0x62 0 $((blksz * nr))" "${SCRATCH_MNT}/RTRMAPBT"
+ ./src/punch-alternating "${SCRATCH_MNT}/RTRMAPBT"
+ fi
+
+ # Reference-count btree
+ is_reflink="$(xfs_info "${SCRATCH_MNT}" | grep -c 'reflink=1')"
+ if [ $is_reflink -gt 0 ]; then
+ echo "+ reflink btree"
+ nr="$((blksz * 2 / 12))"
+ $XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((blksz * nr))" "${SCRATCH_MNT}/REFCOUNTBT"
+ cp --reflink=always "${SCRATCH_MNT}/REFCOUNTBT" "${SCRATCH_MNT}/REFCOUNTBT2"
+ ./src/punch-alternating "${SCRATCH_MNT}/REFCOUNTBT"
+ fi
+
# Copy some real files (xfs tests, I guess...)
echo "+ real files"
- #__populate_fill_fs "${SCRATCH_MNT}" 40
- cp -pRdu --reflink=always "${SCRATCH_MNT}/S_IFREG.FMT_BTREE" "${SCRATCH_MNT}/S_IFREG.FMT_BTREE.REFLINK" 2> /dev/null
+ __populate_fill_fs "${SCRATCH_MNT}" 5
umount "${SCRATCH_MNT}"
}
@@ -212,9 +251,7 @@ _scratch_ext4_populate() {
echo "+ extent tree file"
nr="$((blksz * 2 / 12))"
$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((blksz * nr))" "${SCRATCH_MNT}/S_IFREG.FMT_ETREE"
- for i in $(seq 1 2 ${nr}); do
- $XFS_IO_PROG -f -c "fpunch $((i * blksz)) ${blksz}" "${SCRATCH_MNT}/S_IFREG.FMT_ETREE"
- done
+ ./src/punch-alternating "${SCRATCH_MNT}/S_IFREG.FMT_ETREE"
# Directories
# - INLINE
@@ -349,6 +386,39 @@ __populate_check_xfs_attr() {
esac
}
+# Check that there's at least one per-AG btree with multiple levels
+__populate_check_xfs_agbtree_height() {
+ bt_type="$1"
+ nr_ags=$(_scratch_xfs_db -c 'sb 0' -c 'p agcount' | awk '{print $3}')
+
+ case "${bt_type}" in
+ "bno"|"cnt"|"rmap"|"refcnt")
+ hdr="agf"
+ bt_prefix="${bt_type}"
+ ;;
+ "ino")
+ hdr="agi"
+ bt_prefix=""
+ ;;
+ "fino")
+ hdr="agi"
+ bt_prefix="free_"
+ ;;
+ *)
+ _fail "Don't know about AG btree ${bt_type}"
+ ;;
+ esac
+
+ seq 0 $((nr_ags - 1)) | while read ag; do
+ bt_level=$(_scratch_xfs_db -c "${hdr} ${ag}" -c "p ${bt_prefix}level" | awk '{print $3}')
+ if [ "${bt_level}" -gt 1 ]; then
+ return 100
+ fi
+ done
+ test $? -eq 100 || _fail "Failed to create ${bt_type} of sufficient height!"
+ return 1
+}
+
# Check that populate created all the types of files we wanted
_scratch_xfs_populate_check() {
_scratch_mount
@@ -367,6 +437,9 @@ _scratch_xfs_populate_check() {
leaf_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_LEAF")"
node_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_NODE")"
btree_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_BTREE")"
+ is_finobt=$(xfs_info "${SCRATCH_MNT}" | grep -c 'finobt=1')
+ is_rmapbt=$(xfs_info "${SCRATCH_MNT}" | grep -c 'rmapbt=1')
+ is_reflink=$(xfs_info "${SCRATCH_MNT}" | grep -c 'reflink=1')
blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
dblksz="$(xfs_info "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
@@ -389,6 +462,10 @@ _scratch_xfs_populate_check() {
__populate_check_xfs_attr "${node_attr}" "node"
__populate_check_xfs_attr "${btree_attr}" "btree"
__populate_check_xfs_aformat "${btree_attr}" "btree"
+ __populate_check_xfs_agbtree_height "bno"
+ __populate_check_xfs_agbtree_height "cnt"
+ test $is_rmapbt -ne 0 && __populate_check_xfs_agbtree_height "rmap"
+ test $is_reflink -ne 0 && __populate_check_xfs_agbtree_height "refcnt"
}
# Check data fork format of ext4 file
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 2/9] populate: add _require_populate_commands to check for tools
2017-01-21 8:10 [PATCH v5 0/9] xfstests: online scrub/repair support Darrick J. Wong
2017-01-21 8:10 ` [PATCH 1/9] populate: create all types of XFS metadata Darrick J. Wong
@ 2017-01-21 8:10 ` Darrick J. Wong
2017-01-21 8:10 ` [PATCH 3/9] populate: optionally fill the filesystem when populating fs Darrick J. Wong
` (7 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-21 8:10 UTC (permalink / raw)
To: eguan, darrick.wong; +Cc: linux-xfs, fstests
Back when I created common/populate, I thought it was sufficient to
_require the tools that the populate functions need in the main
file. This turned out to be a bit sloppy, so move them into a
helper function and call it from everything that uses populate.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
common/populate | 9 ++++++---
tests/ext4/006 | 1 +
tests/xfs/083 | 3 +--
tests/xfs/085 | 1 +
tests/xfs/086 | 1 +
tests/xfs/087 | 1 +
tests/xfs/088 | 1 +
tests/xfs/089 | 1 +
tests/xfs/091 | 1 +
tests/xfs/093 | 1 +
tests/xfs/097 | 1 +
tests/xfs/098 | 1 +
tests/xfs/099 | 1 +
tests/xfs/100 | 1 +
tests/xfs/101 | 1 +
tests/xfs/102 | 1 +
tests/xfs/105 | 1 +
tests/xfs/112 | 1 +
tests/xfs/113 | 1 +
tests/xfs/117 | 1 +
tests/xfs/120 | 1 +
tests/xfs/123 | 1 +
tests/xfs/124 | 1 +
tests/xfs/125 | 1 +
tests/xfs/126 | 1 +
tests/xfs/269 | 1 +
tests/xfs/273 | 1 +
27 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/common/populate b/common/populate
index 164fdd3..c19666a 100644
--- a/common/populate
+++ b/common/populate
@@ -22,9 +22,12 @@
# Mountain View, CA 94043, USA, or: http://www.sgi.com
#-----------------------------------------------------------------------
-_require_xfs_io_command "falloc"
-_require_xfs_io_command "fpunch"
-_require_test_program "punch-alternating"
+_require_populate_commands() {
+ _require_xfs_io_command "falloc"
+ _require_xfs_io_command "fpunch"
+ _require_test_program "punch-alternating"
+ _require_command "$XFS_DB_PROG" "xfs_db"
+}
_require_xfs_db_blocktrash_z_command() {
test "${FSTYP}" = "xfs" || _notrun "cannot run xfs_db on ${FSTYP}"
diff --git a/tests/ext4/006 b/tests/ext4/006
index f6cca66..9662f50 100755
--- a/tests/ext4/006
+++ b/tests/ext4/006
@@ -54,6 +54,7 @@ _supported_os Linux
_require_scratch
_require_attrs
+_require_populate_commands
repair_scratch() {
fsck_pass="$1"
diff --git a/tests/xfs/083 b/tests/xfs/083
index 040f3b6..39bd75f 100755
--- a/tests/xfs/083
+++ b/tests/xfs/083
@@ -48,12 +48,11 @@ _cleanup()
_supported_fs xfs
_supported_os Linux
-_require_xfs_io_command "falloc"
-_require_xfs_io_command "fpunch"
_require_scratch
#_require_xfs_crc # checksum not required, but you probably want it anyway...
#_require_xfs_mkfs_crc
_require_attrs
+_require_populate_commands
scratch_repair() {
fsck_pass="$1"
diff --git a/tests/xfs/085 b/tests/xfs/085
index 1ca5354..0c85850 100755
--- a/tests/xfs/085
+++ b/tests/xfs/085
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
rm -f $seqres.full
diff --git a/tests/xfs/086 b/tests/xfs/086
index cf0a71a..787f886 100755
--- a/tests/xfs/086
+++ b/tests/xfs/086
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/087 b/tests/xfs/087
index 0bb3ec1..58ba958 100755
--- a/tests/xfs/087
+++ b/tests/xfs/087
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/088 b/tests/xfs/088
index d6972a4..36745b2 100755
--- a/tests/xfs/088
+++ b/tests/xfs/088
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/089 b/tests/xfs/089
index 06996a5..52bdd54 100755
--- a/tests/xfs/089
+++ b/tests/xfs/089
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/091 b/tests/xfs/091
index a263cb0..ae62337 100755
--- a/tests/xfs/091
+++ b/tests/xfs/091
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/093 b/tests/xfs/093
index 753231e..0f9311e 100755
--- a/tests/xfs/093
+++ b/tests/xfs/093
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/097 b/tests/xfs/097
index a75f06a..303ad04 100755
--- a/tests/xfs/097
+++ b/tests/xfs/097
@@ -52,6 +52,7 @@ _require_xfs_mkfs_finobt
_require_xfs_finobt
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/098 b/tests/xfs/098
index 581377e..7873f32 100755
--- a/tests/xfs/098
+++ b/tests/xfs/098
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/099 b/tests/xfs/099
index 85193ab..7835df9 100755
--- a/tests/xfs/099
+++ b/tests/xfs/099
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/100 b/tests/xfs/100
index 3bfafce..ebb656d 100755
--- a/tests/xfs/100
+++ b/tests/xfs/100
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/101 b/tests/xfs/101
index d3abd19..709fc9d 100755
--- a/tests/xfs/101
+++ b/tests/xfs/101
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/102 b/tests/xfs/102
index cf0d7a6..3d51c6a 100755
--- a/tests/xfs/102
+++ b/tests/xfs/102
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/105 b/tests/xfs/105
index 07ccf00..fc91a4f 100755
--- a/tests/xfs/105
+++ b/tests/xfs/105
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/112 b/tests/xfs/112
index 84f1f1d..ae75684 100755
--- a/tests/xfs/112
+++ b/tests/xfs/112
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/113 b/tests/xfs/113
index ec328bc..c347db7 100755
--- a/tests/xfs/113
+++ b/tests/xfs/113
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/117 b/tests/xfs/117
index f251fb3..f0b95aa 100755
--- a/tests/xfs/117
+++ b/tests/xfs/117
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/120 b/tests/xfs/120
index 3deece6..5a38000 100755
--- a/tests/xfs/120
+++ b/tests/xfs/120
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/123 b/tests/xfs/123
index e6cd8e7..7355e86 100755
--- a/tests/xfs/123
+++ b/tests/xfs/123
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/124 b/tests/xfs/124
index cfea2e6..a828dd6 100755
--- a/tests/xfs/124
+++ b/tests/xfs/124
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/125 b/tests/xfs/125
index 3f2f6f0..3afb4cc 100755
--- a/tests/xfs/125
+++ b/tests/xfs/125
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/126 b/tests/xfs/126
index 77779e0..d696ff1 100755
--- a/tests/xfs/126
+++ b/tests/xfs/126
@@ -50,6 +50,7 @@ _supported_os Linux
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
+_require_populate_commands
_require_xfs_db_blocktrash_z_command
test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
diff --git a/tests/xfs/269 b/tests/xfs/269
index b51ce64..318dd22 100755
--- a/tests/xfs/269
+++ b/tests/xfs/269
@@ -44,6 +44,7 @@ _cleanup()
# real QA test starts here
_supported_os Linux
_require_scratch
+_require_populate_commands
_require_test_program "attr-list-by-handle-cursor-test"
rm -f "$seqres.full"
diff --git a/tests/xfs/273 b/tests/xfs/273
index f4b57bb..1a4ee93 100755
--- a/tests/xfs/273
+++ b/tests/xfs/273
@@ -44,6 +44,7 @@ _cleanup()
_supported_os Linux
_supported_fs xfs
_require_scratch
+_require_populate_commands
_require_xfs_io_command "fsmap"
rm -f "$seqres.full"
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 3/9] populate: optionally fill the filesystem when populating fs
2017-01-21 8:10 [PATCH v5 0/9] xfstests: online scrub/repair support Darrick J. Wong
2017-01-21 8:10 ` [PATCH 1/9] populate: create all types of XFS metadata Darrick J. Wong
2017-01-21 8:10 ` [PATCH 2/9] populate: add _require_populate_commands to check for tools Darrick J. Wong
@ 2017-01-21 8:10 ` Darrick J. Wong
2017-01-21 8:10 ` [PATCH 4/9] populate: fix some silly errors when modifying a fs while fuzzing Darrick J. Wong
` (6 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-21 8:10 UTC (permalink / raw)
To: eguan, darrick.wong; +Cc: linux-xfs, fstests
Be a little more flexible in how much we fill up a pre-populated
filesystem. For the field fuzzing tests, we don't need the extra
space/inode usage and therefore won't want much at all.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
common/populate | 37 +++++++++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 8 deletions(-)
diff --git a/common/populate b/common/populate
index c19666a..23a8ffd 100644
--- a/common/populate
+++ b/common/populate
@@ -73,26 +73,39 @@ __populate_create_attr() {
done
}
-# Fill up 60% of the remaining free space
+# Fill up some percentage of the remaining free space
__populate_fill_fs() {
dir="$1"
pct="$2"
test -z "${pct}" && pct=60
- SRC_SZ="$(du -ks "${SRCDIR}" | cut -f 1)"
+ mkdir -p "${dir}/test/1"
+ cp -pRdu "${dir}"/S_IFREG* "${dir}/test/1/"
+
+ SRC_SZ="$(du -ks "${dir}/test/1" | cut -f 1)"
FS_SZ="$(( $(stat -f "${dir}" -c '%a * %S') / 1024 ))"
NR="$(( (FS_SZ * ${pct} / 100) / SRC_SZ ))"
- test "${NR}" -lt 1 && NR=1
- seq 1 "${NR}" | while read nr; do
- cp -pRdu "${SRCDIR}" "${dir}/test.${nr}" >> $seqres.full 2>&1
+ echo "FILL FS"
+ echo "src_sz $SRC_SZ fs_sz $FS_SZ nr $NR"
+ seq 2 "${NR}" | while read nr; do
+ cp -pRdu "${dir}/test/1" "${dir}/test/${nr}"
done
}
# Populate an XFS on the scratch device with (we hope) all known
# types of metadata block
_scratch_xfs_populate() {
+ fill=1
+
+ for arg in $@; do
+ case "${arg}" in
+ "nofill")
+ fill=0;;
+ esac
+ done
+
_scratch_mount
blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
dblksz="$(xfs_info "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
@@ -225,7 +238,7 @@ _scratch_xfs_populate() {
# Copy some real files (xfs tests, I guess...)
echo "+ real files"
- __populate_fill_fs "${SCRATCH_MNT}" 5
+ test $fill -ne 0 && __populate_fill_fs "${SCRATCH_MNT}" 5
umount "${SCRATCH_MNT}"
}
@@ -233,6 +246,15 @@ _scratch_xfs_populate() {
# Populate an ext4 on the scratch device with (we hope) all known
# types of metadata block
_scratch_ext4_populate() {
+ fill=1
+
+ for arg in $@; do
+ case "${arg}" in
+ "nofill")
+ fill=0;;
+ esac
+ done
+
_scratch_mount
blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
dblksz="${blksz}"
@@ -300,8 +322,7 @@ _scratch_ext4_populate() {
# Copy some real files (xfs tests, I guess...)
echo "+ real files"
- __populate_fill_fs "${SCRATCH_MNT}"
- cp -pRdu --reflink=always "${SCRATCH_MNT}/S_IFREG.FMT_ETREE" "${SCRATCH_MNT}/S_IREG.FMT_ETREE.REFLINK" 2> /dev/null
+ test $fill -ne 0 && __populate_fill_fs "${SCRATCH_MNT}" 5
umount "${SCRATCH_MNT}"
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 4/9] populate: fix some silly errors when modifying a fs while fuzzing
2017-01-21 8:10 [PATCH v5 0/9] xfstests: online scrub/repair support Darrick J. Wong
` (2 preceding siblings ...)
2017-01-21 8:10 ` [PATCH 3/9] populate: optionally fill the filesystem when populating fs Darrick J. Wong
@ 2017-01-21 8:10 ` Darrick J. Wong
2017-01-21 8:10 ` [PATCH 5/9] common/fuzzy: move fuzzing helper functions here Darrick J. Wong
` (5 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-21 8:10 UTC (permalink / raw)
To: eguan, darrick.wong; +Cc: linux-xfs, fstests
There were some silly errors in _scratch_fuzz_modify such that it
wasn't really doing much of anything because of undefined variables.
(Sloppy refactoring when converting xfsfuzz.sh into xfstests.)
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
common/populate | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/common/populate b/common/populate
index 23a8ffd..1afab46 100644
--- a/common/populate
+++ b/common/populate
@@ -596,7 +596,7 @@ _scratch_populate() {
_scratch_xfs_populate
_scratch_xfs_populate_check
;;
- "ext4")
+ "ext2"|"ext3"|"ext4")
_scratch_ext4_populate
_scratch_ext4_populate_check
;;
@@ -612,22 +612,24 @@ _scratch_fuzz_modify() {
test -z "${nr}" && nr=50000
echo "+++ touch ${nr} files"
- $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${BLK_SZ}" "/tmp/afile" > /dev/null
+ blk_sz=$(stat -f -c '%s' ${SCRATCH_MNT})
+ $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${blk_sz}" "/tmp/afile" > /dev/null
date="$(date)"
find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n "${nr}" | while read f; do
setfattr -n "user.date" -v "${date}" "$f"
cat "/tmp/afile" >> "$f"
mv "$f" "$f.longer"
done
+ sync
rm -rf "/tmp/afile"
echo "+++ create files"
- cp -pRdu "${SRCDIR}" "${SCRATCH_MNT}/test.moo"
+ mkdir -p "${SCRATCH_MNT}/test.moo"
+ $XFS_IO_PROG -f -c 'pwrite -S 0x80 0 65536' "${SCRATCH_MNT}/test.moo/urk"
sync
echo "+++ remove files"
rm -rf "${SCRATCH_MNT}/test.moo"
- rm -rf "${SCRATCH_MNT}/test.1"
}
# Try to access files after fuzzing
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 5/9] common/fuzzy: move fuzzing helper functions here
2017-01-21 8:10 [PATCH v5 0/9] xfstests: online scrub/repair support Darrick J. Wong
` (3 preceding siblings ...)
2017-01-21 8:10 ` [PATCH 4/9] populate: fix some silly errors when modifying a fs while fuzzing Darrick J. Wong
@ 2017-01-21 8:10 ` Darrick J. Wong
2017-01-27 8:12 ` Eryu Guan
2017-01-21 8:10 ` [PATCH 6/9] populate: cache scratch metadata images Darrick J. Wong
` (4 subsequent siblings)
9 siblings, 1 reply; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-21 8:10 UTC (permalink / raw)
To: eguan, darrick.wong; +Cc: linux-xfs, fstests
Move some fuzzing helper functions into a new common/fuzzy file.
We'll add a lot more fuzzing helpers in subsequent patches.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
common/fuzzy | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
common/populate | 35 ------------------------
tests/ext4/006 | 1 +
tests/xfs/083 | 1 +
4 files changed, 82 insertions(+), 35 deletions(-)
create mode 100644 common/fuzzy
diff --git a/common/fuzzy b/common/fuzzy
new file mode 100644
index 0000000..d4f8274
--- /dev/null
+++ b/common/fuzzy
@@ -0,0 +1,80 @@
+##/bin/bash
+
+# Routines for fuzzing and scrubbing a filesystem.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 Oracle. 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will 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 to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+#-----------------------------------------------------------------------
+
+# Modify various files after a fuzzing operation
+_scratch_fuzz_modify() {
+ nr="$1"
+
+ test -z "${nr}" && nr=50000
+ echo "+++ touch ${nr} files"
+ blk_sz=$(stat -f -c '%s' ${SCRATCH_MNT})
+ $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${blk_sz}" "/tmp/afile" > /dev/null
+ date="$(date)"
+ find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n "${nr}" | while read f; do
+ setfattr -n "user.date" -v "${date}" "$f"
+ cat "/tmp/afile" >> "$f"
+ mv "$f" "$f.longer"
+ done
+ sync
+ rm -rf "/tmp/afile"
+
+ echo "+++ create files"
+ mkdir -p "${SCRATCH_MNT}/test.moo"
+ $XFS_IO_PROG -f -c 'pwrite -S 0x80 0 65536' "${SCRATCH_MNT}/test.moo/urk"
+ sync
+
+ echo "+++ remove files"
+ rm -rf "${SCRATCH_MNT}/test.moo"
+}
+
+# Try to access files after fuzzing
+_scratch_fuzz_test() {
+ echo "+++ ls -laR" >> $seqres.full
+ ls -laR "${SCRATCH_MNT}/test.1/" >/dev/null 2>&1
+
+ echo "+++ cat files" >> $seqres.full
+ (find "${SCRATCH_MNT}/test.1/" -type f -size -1048576k -print0 | xargs -0 cat) >/dev/null 2>&1
+}
+
+# Do we have an online scrub program?
+_require_scrub() {
+ case "${FSTYP}" in
+ "xfs"|"ext4")
+ test -x $XFS_SCRUB_PROG || _notrun "xfs_scrub not found"
+ ;;
+ *)
+ _notrun "No online scrub program for ${FSTYP}."
+ ;;
+ esac
+}
+
+# Scrub the scratch filesystem metadata (online)
+_scratch_scrub() {
+ case "${FSTYP}" in
+ "xfs"|"ext4"|"ext3"|"ext2")
+ $XFS_SCRUB_PROG -d -T -v "$@" $SCRATCH_MNT
+ ;;
+ *)
+ _fail "No online scrub program for ${FSTYP}."
+ ;;
+ esac
+}
diff --git a/common/populate b/common/populate
index 1afab46..cf6a80b 100644
--- a/common/populate
+++ b/common/populate
@@ -606,41 +606,6 @@ _scratch_populate() {
esac
}
-# Modify various files after a fuzzing operation
-_scratch_fuzz_modify() {
- nr="$1"
-
- test -z "${nr}" && nr=50000
- echo "+++ touch ${nr} files"
- blk_sz=$(stat -f -c '%s' ${SCRATCH_MNT})
- $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${blk_sz}" "/tmp/afile" > /dev/null
- date="$(date)"
- find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n "${nr}" | while read f; do
- setfattr -n "user.date" -v "${date}" "$f"
- cat "/tmp/afile" >> "$f"
- mv "$f" "$f.longer"
- done
- sync
- rm -rf "/tmp/afile"
-
- echo "+++ create files"
- mkdir -p "${SCRATCH_MNT}/test.moo"
- $XFS_IO_PROG -f -c 'pwrite -S 0x80 0 65536' "${SCRATCH_MNT}/test.moo/urk"
- sync
-
- echo "+++ remove files"
- rm -rf "${SCRATCH_MNT}/test.moo"
-}
-
-# Try to access files after fuzzing
-_scratch_fuzz_test() {
- echo "+++ ls -laR" >> $seqres.full
- ls -laR "${SCRATCH_MNT}/test.1/" >/dev/null 2>&1
-
- echo "+++ cat files" >> $seqres.full
- (find "${SCRATCH_MNT}/test.1/" -type f -size -1048576k -print0 | xargs -0 cat) >/dev/null 2>&1
-}
-
# Fill a file system by repeatedly creating files in the given folder
# starting with the given file size. Files are reduced in size when
# they can no longer fit until no more files can be created.
diff --git a/tests/ext4/006 b/tests/ext4/006
index 9662f50..bb9b7e5 100755
--- a/tests/ext4/006
+++ b/tests/ext4/006
@@ -43,6 +43,7 @@ _cleanup()
. ./common/filter
. ./common/attr
. ./common/populate
+. ./common/fuzzy
if [ ! -x "$(which e2fuzz)" ]; then
_notrun "Couldn't find e2fuzz"
diff --git a/tests/xfs/083 b/tests/xfs/083
index 39bd75f..e2b5f82 100755
--- a/tests/xfs/083
+++ b/tests/xfs/083
@@ -43,6 +43,7 @@ _cleanup()
. ./common/filter
. ./common/attr
. ./common/populate
+. ./common/fuzzy
# real QA test starts here
_supported_fs xfs
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 6/9] populate: cache scratch metadata images
2017-01-21 8:10 [PATCH v5 0/9] xfstests: online scrub/repair support Darrick J. Wong
` (4 preceding siblings ...)
2017-01-21 8:10 ` [PATCH 5/9] common/fuzzy: move fuzzing helper functions here Darrick J. Wong
@ 2017-01-21 8:10 ` Darrick J. Wong
2017-01-21 8:11 ` [PATCH 7/9] populate: discover XFS structure fields and fuzz verbs, and use them to fuzz fields Darrick J. Wong
` (3 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-21 8:10 UTC (permalink / raw)
To: eguan, darrick.wong; +Cc: linux-xfs, fstests
Create a helper function to create a populated FS image and dump the
metadata into a file on the test device, with the purpose of allowing
future (fuzzer) invocations of _populate_fs use the cached metadata to
save time.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
common/populate | 44 ++++++++++++++++++++++++++++++++++++++++++++
common/rc | 3 ++-
2 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/common/populate b/common/populate
index cf6a80b..8602f8a 100644
--- a/common/populate
+++ b/common/populate
@@ -673,3 +673,47 @@ _fill_fs()
file_count=$((file_count + 1))
done
}
+
+# Populate a scratch FS from scratch or from a cached image.
+_scratch_populate_cached() {
+ POPULATE_METADUMP="${TEST_DIR}/__populate.${FSTYP}"
+ POPULATE_METADUMP_DESCR="${TEST_DIR}/__populate.${FSTYP}.txt"
+
+ # Don't keep metadata images cached for more 48 hours...
+ rm -rf "$(find "${POPULATE_METADUMP}" -mtime +2 2>/dev/null)"
+
+ # Throw away cached image if it doesn't match our spec.
+ meta_descr="FSTYP ${FSTYP} MKFS_OPTIONS ${MKFS_OPTIONS} SIZE $(blockdev --getsz "${SCRATCH_DEV}") ARGS $@"
+ cmp -s "${POPULATE_METADUMP_DESCR}" <(echo "${meta_descr}") || rm -rf "${POPULATE_METADUMP}"
+
+ # Do we have a cached image?
+ if [ -r "${POPULATE_METADUMP}" ]; then
+ case "${FSTYP}" in
+ "xfs")
+ xfs_mdrestore "${POPULATE_METADUMP}" "${SCRATCH_DEV}" && return
+ ;;
+ "ext2"|"ext3"|"ext4")
+ e2image -r "${POPULATE_METADUMP}" "${SCRATCH_DEV}" && return
+ ;;
+ esac
+ fi
+
+ # Oh well, just create one from scratch
+ _scratch_mkfs
+ echo "${meta_descr}" > "${POPULATE_METADUMP_DESCR}"
+ case "${FSTYP}" in
+ "xfs")
+ _scratch_xfs_populate $@
+ _scratch_xfs_populate_check
+ _scratch_metadump "${POPULATE_METADUMP}" -a -o
+ ;;
+ "ext2"|"ext3"|"ext4")
+ _scratch_ext4_populate $@
+ _scratch_ext4_populate_check
+ e2image -Q "${SCRATCH_DEV}" "${POPULATE_METADUMP}"
+ ;;
+ *)
+ _fail "Don't know how to populate a ${FSTYP} filesystem."
+ ;;
+ esac
+}
diff --git a/common/rc b/common/rc
index 7ffbdd9..c7583fa 100644
--- a/common/rc
+++ b/common/rc
@@ -471,12 +471,13 @@ _scratch_do_mkfs()
_scratch_metadump()
{
dumpfile=$1
+ shift
options=
[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
options="-l $SCRATCH_LOGDEV"
- xfs_metadump $options $SCRATCH_DEV $dumpfile
+ xfs_metadump $options "$@" $SCRATCH_DEV $dumpfile
}
_setup_large_ext4_fs()
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 7/9] populate: discover XFS structure fields and fuzz verbs, and use them to fuzz fields
2017-01-21 8:10 [PATCH v5 0/9] xfstests: online scrub/repair support Darrick J. Wong
` (5 preceding siblings ...)
2017-01-21 8:10 ` [PATCH 6/9] populate: cache scratch metadata images Darrick J. Wong
@ 2017-01-21 8:11 ` Darrick J. Wong
2017-01-21 8:11 ` [PATCH 8/9] common/populate: create attrs in different namespaces Darrick J. Wong
` (2 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-21 8:11 UTC (permalink / raw)
To: eguan, darrick.wong; +Cc: linux-xfs, fstests
Create some routines to help us perform targeted fuzzing of individual
fields in various XFS structures. Specifically, we want the caller to
drop the xfs_db iocursor on the victim field; from there, the scripts
should discover all available fields and fuzzing verbs, and try each
fuzz verb on every available field.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
--
v2: fix some errors found by Eryu Guan.
v3: allow tests to blacklist certain fields, and allow the user to
force fuzz certain fields using certain fuzz verbs.
---
common/fuzzy | 264 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 264 insertions(+)
diff --git a/common/fuzzy b/common/fuzzy
index d4f8274..2df7222 100644
--- a/common/fuzzy
+++ b/common/fuzzy
@@ -78,3 +78,267 @@ _scratch_scrub() {
;;
esac
}
+
+# Filter the xfs_db print command's field debug information
+# into field name and type.
+__filter_xfs_db_print_fields() {
+ filter="$1"
+ if [ -z "${filter}" ] || [ "${filter}" = "nofilter" ]; then
+ filter='^'
+ fi
+ grep ' = ' | while read key equals value; do
+ # Filter out any keys with an array index >= 10, and
+ # collapse any array range ("[1-195]") to the first item.
+ fuzzkey="$(echo "${key}" | sed -e '/\([a-z]*\)\[\([0-9][0-9]\+\)\].*/d' -e 's/\([a-zA-Z0-9_]*\)\[\([0-9]*\)-[0-9]*\]/\1[\2]/g')"
+ if [ -z "${fuzzkey}" ]; then
+ continue
+ elif [[ "${value}" == "["* ]]; then
+ echo "${value}" | sed -e 's/^.//g' -e 's/.$//g' -e 's/,/\n/g' | while read subfield; do
+ echo "${fuzzkey}.${subfield}"
+ done
+ else
+ echo "${fuzzkey}"
+ fi
+ done | egrep "${filter}"
+}
+
+# Navigate to some part of the filesystem and print the field info.
+# The first argument is an egrep filter for the fields
+# The rest of the arguments are xfs_db commands to locate the metadata.
+_scratch_xfs_list_metadata_fields() {
+ filter="$1"
+ shift
+ if [ -n "${SCRATCH_XFS_LIST_METADATA_FIELDS}" ]; then
+ echo "${SCRATCH_XFS_LIST_METADATA_FIELDS}" | tr '[ ,]' '[\n\n]'
+ return;
+ fi
+
+ local cmds=()
+ for arg in "$@"; do
+ cmds+=("-c" "${arg}")
+ done
+ _scratch_xfs_db "${cmds[@]}" -c print | __filter_xfs_db_print_fields "${filter}"
+}
+
+# Get a metadata field
+# The first arg is the field name
+# The rest of the arguments are xfs_db commands to find the metadata.
+_scratch_xfs_get_metadata_field() {
+ key="$1"
+ shift
+
+ grep_key="$(echo "${key}" | tr '[]()' '....')"
+ local cmds=()
+ for arg in "$@"; do
+ cmds+=("-c" "${arg}")
+ done
+ _scratch_xfs_db "${cmds[@]}" -c "print ${key}" | grep "^${grep_key}" | \
+ sed -e 's/^.* = //g'
+}
+
+# Set a metadata field
+# The first arg is the field name
+# The second arg is the new value
+# The rest of the arguments are xfs_db commands to find the metadata.
+_scratch_xfs_set_metadata_field() {
+ key="$1"
+ value="$2"
+ shift; shift
+
+ local cmds=()
+ for arg in "$@"; do
+ cmds+=("-c" "${arg}")
+ done
+ _scratch_xfs_db -x "${cmds[@]}" -c "write -d ${key} ${value}"
+ echo
+}
+
+# Fuzz a metadata field
+# The first arg is the field name
+# The second arg is the xfs_db fuzz verb
+# The rest of the arguments are xfs_db commands to find the metadata.
+_scratch_xfs_fuzz_metadata_field() {
+ key="$1"
+ value="$2"
+ shift; shift
+
+ if [[ "${key}" == *crc ]]; then
+ fuzz_arg="-c"
+ else
+ fuzz_arg="-d"
+ fi
+ oldval="$(_scratch_xfs_get_metadata_field "${key}" "$@")"
+
+ local cmds=()
+ for arg in "$@"; do
+ cmds+=("-c" "${arg}")
+ done
+ _scratch_xfs_db -x "${cmds[@]}" -c "fuzz ${fuzz_arg} ${key} ${value}"
+ echo
+ newval="$(_scratch_xfs_get_metadata_field "${key}" "$@" 2> /dev/null)"
+ if [ "${oldval}" = "${newval}" ]; then
+ echo "Field ${key} already set to ${newval}, skipping test."
+ return 1
+ fi
+ return 0
+}
+
+# Try to forcibly unmount the scratch fs
+__scratch_xfs_fuzz_unmount()
+{
+ while _scratch_unmount 2>/dev/null; do sleep 0.2; done
+}
+
+# Restore metadata to scratch device prior to field-fuzzing.
+__scratch_xfs_fuzz_mdrestore()
+{
+ test -e "${POPULATE_METADUMP}" || _fail "Need to set POPULATE_METADUMP"
+
+ __scratch_xfs_fuzz_unmount
+ xfs_mdrestore "${POPULATE_METADUMP}" "${SCRATCH_DEV}"
+}
+
+__fuzz_notify() {
+ echo "$@"
+ test -w /dev/ttyprintk && echo "$@" >> /dev/ttyprintk
+}
+
+# Fuzz one field of some piece of metadata.
+# First arg is the field name
+# Second arg is the fuzz verb (ones, zeroes, random, add, sub...)
+# Third arg is the repair mode (online, offline, both)
+__scratch_xfs_fuzz_field_test() {
+ field="$1"
+ fuzzverb="$2"
+ repair="$3"
+ shift; shift; shift
+
+ # Set the new field value
+ __fuzz_notify "+ Fuzz ${field} = ${fuzzverb}"
+ echo "========================"
+ _scratch_xfs_fuzz_metadata_field "${field}" ${fuzzverb} "$@"
+ res=$?
+ test $res -ne 0 && return
+
+ # Try to catch the error with scrub
+ echo "+ Try to catch the error"
+ _scratch_mount 2>&1
+ res=$?
+ if [ $res -eq 0 ]; then
+ # Try an online scrub unless we're fuzzing ag 0's sb,
+ # which scrub doesn't know how to fix.
+ echo "++ Online scrub"
+ if [ "$1" != "sb 0" ]; then
+ _scratch_scrub -n -a 1 -e continue 2>&1
+ res=$?
+ test $res -eq 0 && \
+ (>&2 echo "scrub didn't fail with ${field} = ${fuzzverb}.")
+ fi
+
+ # Try fixing the filesystem online?!
+ if [ "${repair}" = "online" ] || [ "${repair}" = "both" ]; then
+ __fuzz_notify "++ Try to repair filesystem online"
+ _scratch_scrub -y 2>&1
+ res=$?
+ test $res -ne 0 && \
+ (>&2 echo "online repair failed ($res) with ${field} = ${fuzzverb}.")
+ fi
+
+ __scratch_xfs_fuzz_unmount
+ elif [ "${repair}" = "online" ] || [ "${repair}" = "both" ]; then
+ (>&2 echo "mount failed ($res) with ${field} = ${fuzzverb}.")
+ fi
+
+ # Repair the filesystem offline?
+ if [ "${repair}" = "offline" ] || [ "${repair}" = "both" ]; then
+ echo "+ Try to repair the filesystem offline"
+ _repair_scratch_fs 2>&1
+ res=$?
+ test $res -ne 0 && \
+ (>&2 echo "offline repair failed ($res) with ${field} = ${fuzzverb}.")
+ fi
+
+ # See if repair finds a clean fs
+ echo "+ Make sure error is gone (offline)"
+ _scratch_xfs_repair -n 2>&1
+ res=$?
+ test $res -ne 0 && \
+ (>&2 echo "offline re-scrub ($res) with ${field} = ${fuzzverb}.")
+
+ # See if scrub finds a clean fs
+ echo "+ Make sure error is gone (online)"
+ _scratch_mount 2>&1
+ res=$?
+ if [ $res -eq 0 ]; then
+ # Try an online scrub unless we're fuzzing ag 0's sb,
+ # which scrub doesn't know how to fix.
+ echo "++ Online scrub"
+ if [ "$1" != "sb 0" ]; then
+ _scratch_scrub -e continue 2>&1
+ res=$?
+ test $res -ne 0 && \
+ (>&2 echo "online re-scrub ($res) with ${field} = ${fuzzverb}.")
+ fi
+
+ # Try modifying the filesystem again!
+ __fuzz_notify "++ Try to write filesystem again"
+ _scratch_fuzz_modify 100 2>&1
+ __scratch_xfs_fuzz_unmount
+ else
+ (>&2 echo "re-mount failed ($res) with ${field} = ${fuzzverb}.")
+ fi
+
+ # See if repair finds a clean fs
+ echo "+ Re-check the filesystem (offline)"
+ _scratch_xfs_repair -n 2>&1
+ res=$?
+ test $res -ne 0 && \
+ (>&2 echo "re-repair failed ($res) with ${field} = ${fuzzverb}.")
+}
+
+# Make sure we have all the pieces we need for field fuzzing
+_require_scratch_xfs_fuzz_fields()
+{
+ _require_scratch_nocheck
+ _require_scrub
+ _require_populate_commands
+ _scratch_mkfs_xfs >/dev/null 2>&1
+ _require_xfs_db_command "fuzz"
+}
+
+# Grab the list of available fuzzing verbs
+_scratch_xfs_list_fuzz_verbs() {
+ if [ -n "${SCRATCH_XFS_LIST_FUZZ_VERBS}" ]; then
+ echo "${SCRATCH_XFS_LIST_FUZZ_VERBS}" | tr '[ ,]' '[\n\n]'
+ return;
+ fi
+ _scratch_xfs_db -x -c 'sb 0' -c 'fuzz' | grep '^Verbs:' | \
+ sed -e 's/[,.]//g' -e 's/Verbs: //g' -e 's/ /\n/g'
+}
+
+# Fuzz some of the fields of some piece of metadata
+# The first argument is an egrep filter for the field names
+# The second argument is the repair mode (online, offline, both)
+# The rest of the arguments are xfs_db commands to locate the metadata.
+#
+# Users can specify the fuzz verbs via SCRATCH_XFS_LIST_FUZZ_VERBS
+# They can specify the fields via SCRATCH_XFS_LIST_METADATA_FIELDS
+_scratch_xfs_fuzz_metadata() {
+ filter="$1"
+ repair="$2"
+ shift; shift
+
+ fields="$(_scratch_xfs_list_metadata_fields "${filter}" "$@")"
+ verbs="$(_scratch_xfs_list_fuzz_verbs)"
+ echo "Fields we propose to fuzz under: $@"
+ echo $(echo "${fields}")
+ echo "Verbs we propose to fuzz with:"
+ echo $(echo "${verbs}")
+
+ echo "${fields}" | while read field; do
+ echo "${verbs}" | while read fuzzverb; do
+ __scratch_xfs_fuzz_mdrestore
+ __scratch_xfs_fuzz_field_test "${field}" "${fuzzverb}" "${repair}" "$@"
+ done
+ done
+}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 8/9] common/populate: create attrs in different namespaces
2017-01-21 8:10 [PATCH v5 0/9] xfstests: online scrub/repair support Darrick J. Wong
` (6 preceding siblings ...)
2017-01-21 8:11 ` [PATCH 7/9] populate: discover XFS structure fields and fuzz verbs, and use them to fuzz fields Darrick J. Wong
@ 2017-01-21 8:11 ` Darrick J. Wong
[not found] ` <CAOQ4uxgDPEQiC72-o7yt0P6o2xdVTb6kQNxoePOzYWRbCCXxKw@mail.gmail.com>
2017-01-26 5:08 ` Eryu Guan
9 siblings, 0 replies; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-21 8:11 UTC (permalink / raw)
To: eguan, darrick.wong; +Cc: linux-xfs, fstests
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
common/populate | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/common/populate b/common/populate
index 8602f8a..e99ce68 100644
--- a/common/populate
+++ b/common/populate
@@ -166,6 +166,9 @@ _scratch_xfs_populate() {
mknod "${SCRATCH_MNT}/S_IFCHR" c 1 1
mknod "${SCRATCH_MNT}/S_IFBLK" c 1 1
+ # special file with an xattr
+ setfacl -P -m u:nobody:r ${SCRATCH_MNT}/S_IFCHR
+
# Attribute formats
# LOCAL
echo "+ local attr"
@@ -183,6 +186,18 @@ _scratch_xfs_populate() {
echo "+ btree attr"
__populate_create_attr "${SCRATCH_MNT}/ATTR.FMT_BTREE" "$((64 * blksz / 40))" true
+ # trusted namespace
+ touch ${SCRATCH_MNT}/ATTR.TRUSTED
+ setfattr -n trusted.moo -v urk ${SCRATCH_MNT}/ATTR.TRUSTED
+
+ # security namespace
+ touch ${SCRATCH_MNT}/ATTR.SECURITY
+ setfattr -n security.foo -v bar ${SCRATCH_MNT}/ATTR.SECURITY
+
+ # system namespace
+ touch ${SCRATCH_MNT}/ATTR.SYSTEM
+ setfacl -m u:root:r ${SCRATCH_MNT}/ATTR.SYSTEM
+
# FMT_EXTENTS with a remote less-than-a-block value
echo "+ attr extents with a remote less-than-a-block value"
touch "${SCRATCH_MNT}/ATTR.FMT_EXTENTS_REMOTE3K"
@@ -305,6 +320,9 @@ _scratch_ext4_populate() {
mknod "${SCRATCH_MNT}/S_IFCHR" c 1 1
mknod "${SCRATCH_MNT}/S_IFBLK" c 1 1
+ # special file with an xattr
+ setfacl -P -m u:nobody:r ${SCRATCH_MNT}/S_IFCHR
+
# Attribute formats
# LOCAL
echo "+ local attr"
@@ -314,6 +332,18 @@ _scratch_ext4_populate() {
echo "+ block attr"
__populate_create_attr "${SCRATCH_MNT}/ATTR.FMT_BLOCK" "$((blksz / 40))"
+ # trusted namespace
+ touch ${SCRATCH_MNT}/ATTR.TRUSTED
+ setfattr -n trusted.moo -v urk ${SCRATCH_MNT}/ATTR.TRUSTED
+
+ # security namespace
+ touch ${SCRATCH_MNT}/ATTR.SECURITY
+ setfattr -n security.foo -v bar ${SCRATCH_MNT}/ATTR.SECURITY
+
+ # system namespace
+ touch ${SCRATCH_MNT}/ATTR.SYSTEM
+ setfacl -m u:root:r ${SCRATCH_MNT}/ATTR.SYSTEM
+
# Make an unused inode
echo "+ empty file"
touch "${SCRATCH_MNT}/unused"
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH v5 0/9] xfstests: online scrub/repair support
[not found] ` <CAOQ4uxgDPEQiC72-o7yt0P6o2xdVTb6kQNxoePOzYWRbCCXxKw@mail.gmail.com>
@ 2017-01-22 5:01 ` Darrick J. Wong
2017-01-22 6:10 ` Amir Goldstein
0 siblings, 1 reply; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-22 5:01 UTC (permalink / raw)
To: Amir Goldstein; +Cc: Eryu Guan, linux-xfs, fstests
On Sat, Jan 21, 2017 at 09:38:23PM +0200, Amir Goldstein wrote:
> On Sat, Jan 21, 2017 at 10:10 AM, Darrick J. Wong
> <darrick.wong@oracle.com> wrote:
> > Hi all,
> >
> > This is the fifth revision of a patchset that adds to XFS userland tools
> > support for online metadata scrubbing and repair.
> >
> > The new patches in this series do three things: first, they expand the
> > filesystem populate commands inside xfstests to be able to create all
> > types of XFS metadata. Second, they create a bunch of xfs_db wrapper
> > functions to iterate all fields present in a given metadata object and
> > fuzz them in various ways. Finally, for each metadata object type there
> > is a separate test that iteratively fuzzes all fields of that object and
> > runs it through the mount/scrub/repair loop to see what happens.
> >
> > If you're going to start using this mess, you probably ought to just
> > pull from my github trees for kernel[1], xfsprogs[2], and xfstests[3].
> > The kernel patches in the git trees should apply to 4.10-rc4; xfsprogs
> > patches to for-next; and xfstest to master.
> >
> > The patches have survived all auto group xfstests both with scrub-only
> > mode and also a special debugging mode to xfs_scrub that forces it to
> > rebuild the metadata structures even if they're not damaged.
> >
>
> Darrick,
>
> xfs/1301 hogs every time at the same point in the test
> after Fuzz dirblklog = middlebit, those are the last words in dmesg:
> Log size 12800 blocks too small, minimum size is 23646 blocks
> XFS (dm-2): AAIEEE! Log failed size checks. Abort!
> XFS (dm-2): log mount failed
Yeah.... there's some oddball problems in xfs_repair where directory
related corruption causes it to misread directory free space so when it
goes to add "unlinked" inodes to lost+found the process goes totally
nuts and/or deadlocks on buffers. I haven't had a chance to figure out
what's causing /this/ particular problem, though..... :(
--D
>
> Then xfs_repair stays at 100% (waited >10 min).
> This is the backtrace from xfs_repair:
>
> libxfs_trans_log_buf (tp=<optimized out>, bp=bp@entry=0x9d7200,
> first=first@entry=65272, last=last@entry=65275) at trans.c:385
> 385 xfs_buf_item_log(bip, first, last);
> (gdb) bt
> #0 libxfs_trans_log_buf (tp=<optimized out>, bp=bp@entry=0x9d7200,
> first=first@entry=65272, last=last@entry=65275) at trans.c:385
> #1 0x000000000045c28d in xfs_dir2_data_log_unused
> (args=args@entry=0xa1fe00, bp=0x9d7200, dup=dup@entry=0xadacf8) at
> xfs_dir2_data.c:712
> #2 0x000000000045b3d2 in xfs_dir2_sf_to_block
> (args=args@entry=0xa1fe00) at xfs_dir2_block.c:1209
> #3 0x0000000000462b84 in xfs_dir2_sf_addname
> (args=args@entry=0xa1fe00) at xfs_dir2_sf.c:339
> #4 0x00000000004594e8 in libxfs_dir_createname (tp=0x9e31b0,
> dp=0x9d6e60, name=name@entry=0x7ffe5fff3690, inum=inum@entry=161,
> first=first@entry=0x7ffe5fff3688, dfops=dfops@entry=0x7ffe5fff36a0,
> total=1848) at xfs_dir2.c:297
> #5 0x000000000042259e in mv_orphanage (mp=mp@entry=0x7ffe5fff4b30,
> ino=ino@entry=161, isa_dir=0) at phase6.c:1205
> #6 0x0000000000423ed4 in check_for_orphaned_inodes (irec=<optimized
> out>, agno=<optimized out>, mp=<optimized out>) at phase6.c:3105
> #7 phase6 (mp=mp@entry=0x7ffe5fff4b30) at phase6.c:3284
> #8 0x0000000000403b5d in main (argc=<optimized out>, argv=<optimized
> out>) at xfs_repair.c:947
>
>
> Attached 1301.full and dmesg from 2 runs.
>
> Using to following branch tips:
>
> xfstests:
> 949963c xfs: actually record per-field fuzzing online repair output
> xfsprogs:
> 3dd963c xfs_scrub: create a script to scrub all xfs filesystems
> kernel:
> fbcd13f xfs: avoid mount-time deadlock in CoW extent recovery
>
> Will let it run through the night see what happens...
>
> Amir.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v5 0/9] xfstests: online scrub/repair support
2017-01-22 5:01 ` [PATCH v5 0/9] xfstests: online scrub/repair support Darrick J. Wong
@ 2017-01-22 6:10 ` Amir Goldstein
0 siblings, 0 replies; 22+ messages in thread
From: Amir Goldstein @ 2017-01-22 6:10 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Eryu Guan, linux-xfs, fstests
On Sun, Jan 22, 2017 at 7:01 AM, Darrick J. Wong
<darrick.wong@oracle.com> wrote:
> On Sat, Jan 21, 2017 at 09:38:23PM +0200, Amir Goldstein wrote:
>> On Sat, Jan 21, 2017 at 10:10 AM, Darrick J. Wong
>> <darrick.wong@oracle.com> wrote:
>> > Hi all,
>> >
>> > This is the fifth revision of a patchset that adds to XFS userland tools
>> > support for online metadata scrubbing and repair.
>> >
>> > The new patches in this series do three things: first, they expand the
>> > filesystem populate commands inside xfstests to be able to create all
>> > types of XFS metadata. Second, they create a bunch of xfs_db wrapper
>> > functions to iterate all fields present in a given metadata object and
>> > fuzz them in various ways. Finally, for each metadata object type there
>> > is a separate test that iteratively fuzzes all fields of that object and
>> > runs it through the mount/scrub/repair loop to see what happens.
>> >
>> > If you're going to start using this mess, you probably ought to just
>> > pull from my github trees for kernel[1], xfsprogs[2], and xfstests[3].
>> > The kernel patches in the git trees should apply to 4.10-rc4; xfsprogs
>> > patches to for-next; and xfstest to master.
>> >
>> > The patches have survived all auto group xfstests both with scrub-only
>> > mode and also a special debugging mode to xfs_scrub that forces it to
>> > rebuild the metadata structures even if they're not damaged.
>> >
>>
>> Darrick,
>>
>> xfs/1301 hogs every time at the same point in the test
>> after Fuzz dirblklog = middlebit, those are the last words in dmesg:
>> Log size 12800 blocks too small, minimum size is 23646 blocks
>> XFS (dm-2): AAIEEE! Log failed size checks. Abort!
>> XFS (dm-2): log mount failed
>
> Yeah.... there's some oddball problems in xfs_repair where directory
> related corruption causes it to misread directory free space so when it
> goes to add "unlinked" inodes to lost+found the process goes totally
> nuts and/or deadlocks on buffers. I haven't had a chance to figure out
> what's causing /this/ particular problem, though..... :(
>
So I guess you are able to reproduce this.
Is there maybe a mode to run the tests where scrub will fix /this/ problem
before running xfs_repair, so xfs_repair won't go off the rails?
I had the impressions that this is what the scrub tests are supposed to do?
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v5 0/9] xfstests: online scrub/repair support
2017-01-21 8:10 [PATCH v5 0/9] xfstests: online scrub/repair support Darrick J. Wong
` (8 preceding siblings ...)
[not found] ` <CAOQ4uxgDPEQiC72-o7yt0P6o2xdVTb6kQNxoePOzYWRbCCXxKw@mail.gmail.com>
@ 2017-01-26 5:08 ` Eryu Guan
2017-01-26 6:44 ` Darrick J. Wong
9 siblings, 1 reply; 22+ messages in thread
From: Eryu Guan @ 2017-01-26 5:08 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-xfs, fstests
On Sat, Jan 21, 2017 at 12:10:19AM -0800, Darrick J. Wong wrote:
> Hi all,
>
> This is the fifth revision of a patchset that adds to XFS userland tools
> support for online metadata scrubbing and repair.
>
> The new patches in this series do three things: first, they expand the
> filesystem populate commands inside xfstests to be able to create all
> types of XFS metadata. Second, they create a bunch of xfs_db wrapper
> functions to iterate all fields present in a given metadata object and
> fuzz them in various ways. Finally, for each metadata object type there
> is a separate test that iteratively fuzzes all fields of that object and
> runs it through the mount/scrub/repair loop to see what happens.
>
> If you're going to start using this mess, you probably ought to just
> pull from my github trees for kernel[1], xfsprogs[2], and xfstests[3].
Are your github trees synced with kernel.org trees? Seems so, and I did
my tests with your kernel.org trees.
> The kernel patches in the git trees should apply to 4.10-rc4; xfsprogs
> patches to for-next; and xfstest to master.
>
> The patches have survived all auto group xfstests both with scrub-only
> mode and also a special debugging mode to xfs_scrub that forces it to
> rebuild the metadata structures even if they're not damaged.
I have trouble finishing running all the tests so far, the tests need
long time to run and in some tests xfs_repair or xfs_scrub are just
spinning there, sometimes I can kill them to make test continue,
sometimes I can't (e.g. xfs/1312, I tried to kill the xfs_scrub process,
but it became <defunc>).
And in most tests I have run, I see such failures:
+scrub didn't fail with length = ones.
+scrub didn't fail with length = firstbit.
+scrub didn't fail with length = middlebit.
+scrub didn't fail with length = lastbit.
....
Not sure if that's expected?
I also hit xfs_scrub and xfs_repair double free bug in xfs/1312 (perhaps
that's why I can't kill it).
OTOH, all these failures/issues seem like kernel or userspace bug, I
went through all the patches and new tests and I didn't find anything
wrong obviously. So I think it's fine to merge them in this week's
update. Unless you have a second thought?
Thanks,
Eryu
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v5 0/9] xfstests: online scrub/repair support
2017-01-26 5:08 ` Eryu Guan
@ 2017-01-26 6:44 ` Darrick J. Wong
2017-01-26 7:26 ` Eryu Guan
0 siblings, 1 reply; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-26 6:44 UTC (permalink / raw)
To: Eryu Guan; +Cc: linux-xfs, fstests
On Thu, Jan 26, 2017 at 01:08:38PM +0800, Eryu Guan wrote:
> On Sat, Jan 21, 2017 at 12:10:19AM -0800, Darrick J. Wong wrote:
> > Hi all,
> >
> > This is the fifth revision of a patchset that adds to XFS userland tools
> > support for online metadata scrubbing and repair.
> >
> > The new patches in this series do three things: first, they expand the
> > filesystem populate commands inside xfstests to be able to create all
> > types of XFS metadata. Second, they create a bunch of xfs_db wrapper
> > functions to iterate all fields present in a given metadata object and
> > fuzz them in various ways. Finally, for each metadata object type there
> > is a separate test that iteratively fuzzes all fields of that object and
> > runs it through the mount/scrub/repair loop to see what happens.
> >
> > If you're going to start using this mess, you probably ought to just
> > pull from my github trees for kernel[1], xfsprogs[2], and xfstests[3].
>
> Are your github trees synced with kernel.org trees? Seems so, and I did
> my tests with your kernel.org trees.
Yes, they are. (Or at least they should be, if I did it correctly.)
> > The kernel patches in the git trees should apply to 4.10-rc4; xfsprogs
> > patches to for-next; and xfstest to master.
> >
> > The patches have survived all auto group xfstests both with scrub-only
> > mode and also a special debugging mode to xfs_scrub that forces it to
> > rebuild the metadata structures even if they're not damaged.
>
> I have trouble finishing running all the tests so far, the tests need
> long time to run and in some tests xfs_repair or xfs_scrub are just
Yes, the amount of dmesg noise slows the tests wayyyyyy down. One of
the newer patches reduces the amount of spew when the scrubbers are
running.
(FWIW when I run them I have a debug patch that shuts up all the
warnings.)
> spinning there, sometimes I can kill them to make test continue,
There are some undiagnosed deadlocks in xfs_repair, and some OOM
problems in xfs_db that didn't get fixed until recently.
> sometimes I can't (e.g. xfs/1312, I tried to kill the xfs_scrub process,
> but it became <defunc>).
That's odd. Next time that happens can you sysrq-t to find out where
the scrub threads are stuck, please?
> And in most tests I have run, I see such failures:
>
> +scrub didn't fail with length = ones.
> +scrub didn't fail with length = firstbit.
> +scrub didn't fail with length = middlebit.
> +scrub didn't fail with length = lastbit.
> ....
>
> Not sure if that's expected?
Yes, that's expected. The scrub routines expect that the repairing
program (xfs_{scrub,repair}) will complain about the corrupt field,
repair it, and a subsequent re-run will exit cleanly. There are quite a
few fields like uid/gid and timestamps that have no inherent meaning to
XFS. As a result, there's no problem to be detected. Some of the
fuzzes will prevent the fs from mounting, which causes other error
messages.
The rest could be undiagnosed problems in other parts of XFS (or scrub).
I've not had time to triage a lot of it. I've been recording exactly
what and where things fail and I'll have a look at them as time allows.
> I also hit xfs_scrub and xfs_repair double free bug in xfs/1312 (perhaps
> that's why I can't kill it).
Maybe. In theory the page refcounts get reset, I think, but I've seen
the VM crash with double-fault errors and other weirdness that seem to
go away when the refcount bugs go away.
> OTOH, all these failures/issues seem like kernel or userspace bug, I
> went through all the patches and new tests and I didn't find anything
> wrong obviously. So I think it's fine to merge them in this week's
> update. Unless you have a second thought?
Sure. I will never enable them in any of the heavily used groups, so
that should be fine. Though I do have a request -- the 13xx numbers are
set up so that if test (1300+x) fuzzes object X and tries to xfs_repair
it, then test (1340+x) fuzzes the same X but tries to xfs_scrub it.
Could you interweave them when you renumber the tests?
e.g. 1302 -> 510, 1342 -> 511, 1303 -> 512, 1343 -> 513?
That'll help me to keep together the repair & scrub fuzz tests.
--D
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v5 0/9] xfstests: online scrub/repair support
2017-01-26 6:44 ` Darrick J. Wong
@ 2017-01-26 7:26 ` Eryu Guan
2017-01-26 7:53 ` Darrick J. Wong
0 siblings, 1 reply; 22+ messages in thread
From: Eryu Guan @ 2017-01-26 7:26 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-xfs, fstests
[-- Attachment #1: Type: text/plain, Size: 4725 bytes --]
On Wed, Jan 25, 2017 at 10:44:34PM -0800, Darrick J. Wong wrote:
> On Thu, Jan 26, 2017 at 01:08:38PM +0800, Eryu Guan wrote:
> > On Sat, Jan 21, 2017 at 12:10:19AM -0800, Darrick J. Wong wrote:
> > > Hi all,
> > >
> > > This is the fifth revision of a patchset that adds to XFS userland tools
> > > support for online metadata scrubbing and repair.
> > >
> > > The new patches in this series do three things: first, they expand the
> > > filesystem populate commands inside xfstests to be able to create all
> > > types of XFS metadata. Second, they create a bunch of xfs_db wrapper
> > > functions to iterate all fields present in a given metadata object and
> > > fuzz them in various ways. Finally, for each metadata object type there
> > > is a separate test that iteratively fuzzes all fields of that object and
> > > runs it through the mount/scrub/repair loop to see what happens.
> > >
> > > If you're going to start using this mess, you probably ought to just
> > > pull from my github trees for kernel[1], xfsprogs[2], and xfstests[3].
> >
> > Are your github trees synced with kernel.org trees? Seems so, and I did
> > my tests with your kernel.org trees.
>
> Yes, they are. (Or at least they should be, if I did it correctly.)
>
> > > The kernel patches in the git trees should apply to 4.10-rc4; xfsprogs
> > > patches to for-next; and xfstest to master.
> > >
> > > The patches have survived all auto group xfstests both with scrub-only
> > > mode and also a special debugging mode to xfs_scrub that forces it to
> > > rebuild the metadata structures even if they're not damaged.
> >
> > I have trouble finishing running all the tests so far, the tests need
> > long time to run and in some tests xfs_repair or xfs_scrub are just
>
> Yes, the amount of dmesg noise slows the tests wayyyyyy down. One of
> the newer patches reduces the amount of spew when the scrubbers are
> running.
>
> (FWIW when I run them I have a debug patch that shuts up all the
> warnings.)
>
> > spinning there, sometimes I can kill them to make test continue,
>
> There are some undiagnosed deadlocks in xfs_repair, and some OOM
> problems in xfs_db that didn't get fixed until recently.
>
> > sometimes I can't (e.g. xfs/1312, I tried to kill the xfs_scrub process,
> > but it became <defunc>).
>
> That's odd. Next time that happens can you sysrq-t to find out where
> the scrub threads are stuck, please?
I still have it in zombie state, attachment is sysrq-t dump saved from
/var/log/message (seems not easy to read..).
>
> > And in most tests I have run, I see such failures:
> >
> > +scrub didn't fail with length = ones.
> > +scrub didn't fail with length = firstbit.
> > +scrub didn't fail with length = middlebit.
> > +scrub didn't fail with length = lastbit.
> > ....
> >
> > Not sure if that's expected?
>
> Yes, that's expected. The scrub routines expect that the repairing
> program (xfs_{scrub,repair}) will complain about the corrupt field,
> repair it, and a subsequent re-run will exit cleanly. There are quite a
> few fields like uid/gid and timestamps that have no inherent meaning to
> XFS. As a result, there's no problem to be detected. Some of the
> fuzzes will prevent the fs from mounting, which causes other error
> messages.
>
> The rest could be undiagnosed problems in other parts of XFS (or scrub).
> I've not had time to triage a lot of it. I've been recording exactly
> what and where things fail and I'll have a look at them as time allows.
>
> > I also hit xfs_scrub and xfs_repair double free bug in xfs/1312 (perhaps
> > that's why I can't kill it).
>
> Maybe. In theory the page refcounts get reset, I think, but I've seen
> the VM crash with double-fault errors and other weirdness that seem to
> go away when the refcount bugs go away.
>
> > OTOH, all these failures/issues seem like kernel or userspace bug, I
> > went through all the patches and new tests and I didn't find anything
> > wrong obviously. So I think it's fine to merge them in this week's
> > update. Unless you have a second thought?
>
> Sure. I will never enable them in any of the heavily used groups, so
> that should be fine. Though I do have a request -- the 13xx numbers are
> set up so that if test (1300+x) fuzzes object X and tries to xfs_repair
> it, then test (1340+x) fuzzes the same X but tries to xfs_scrub it.
> Could you interweave them when you renumber the tests?
Perhaps that explains why there's no 1336-1340 :)
>
> e.g. 1302 -> 510, 1342 -> 511, 1303 -> 512, 1343 -> 513?
>
> That'll help me to keep together the repair & scrub fuzz tests.
Sure, I'll renumber the tests and let you review first before pushing
them to upstream.
Thanks,
Eryu
[-- Attachment #2: xfs_scrub-hang-sysrq-t.log.gz --]
[-- Type: application/gzip, Size: 15300 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v5 0/9] xfstests: online scrub/repair support
2017-01-26 7:26 ` Eryu Guan
@ 2017-01-26 7:53 ` Darrick J. Wong
2017-01-27 1:41 ` Eryu Guan
0 siblings, 1 reply; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-26 7:53 UTC (permalink / raw)
To: Eryu Guan; +Cc: linux-xfs, fstests
On Thu, Jan 26, 2017 at 03:26:38PM +0800, Eryu Guan wrote:
> On Wed, Jan 25, 2017 at 10:44:34PM -0800, Darrick J. Wong wrote:
> > On Thu, Jan 26, 2017 at 01:08:38PM +0800, Eryu Guan wrote:
> > > On Sat, Jan 21, 2017 at 12:10:19AM -0800, Darrick J. Wong wrote:
> > > > Hi all,
> > > >
> > > > This is the fifth revision of a patchset that adds to XFS userland tools
> > > > support for online metadata scrubbing and repair.
> > > >
> > > > The new patches in this series do three things: first, they expand the
> > > > filesystem populate commands inside xfstests to be able to create all
> > > > types of XFS metadata. Second, they create a bunch of xfs_db wrapper
> > > > functions to iterate all fields present in a given metadata object and
> > > > fuzz them in various ways. Finally, for each metadata object type there
> > > > is a separate test that iteratively fuzzes all fields of that object and
> > > > runs it through the mount/scrub/repair loop to see what happens.
> > > >
> > > > If you're going to start using this mess, you probably ought to just
> > > > pull from my github trees for kernel[1], xfsprogs[2], and xfstests[3].
> > >
> > > Are your github trees synced with kernel.org trees? Seems so, and I did
> > > my tests with your kernel.org trees.
> >
> > Yes, they are. (Or at least they should be, if I did it correctly.)
> >
> > > > The kernel patches in the git trees should apply to 4.10-rc4; xfsprogs
> > > > patches to for-next; and xfstest to master.
> > > >
> > > > The patches have survived all auto group xfstests both with scrub-only
> > > > mode and also a special debugging mode to xfs_scrub that forces it to
> > > > rebuild the metadata structures even if they're not damaged.
> > >
> > > I have trouble finishing running all the tests so far, the tests need
> > > long time to run and in some tests xfs_repair or xfs_scrub are just
> >
> > Yes, the amount of dmesg noise slows the tests wayyyyyy down. One of
> > the newer patches reduces the amount of spew when the scrubbers are
> > running.
> >
> > (FWIW when I run them I have a debug patch that shuts up all the
> > warnings.)
> >
> > > spinning there, sometimes I can kill them to make test continue,
> >
> > There are some undiagnosed deadlocks in xfs_repair, and some OOM
> > problems in xfs_db that didn't get fixed until recently.
> >
> > > sometimes I can't (e.g. xfs/1312, I tried to kill the xfs_scrub process,
> > > but it became <defunc>).
> >
> > That's odd. Next time that happens can you sysrq-t to find out where
> > the scrub threads are stuck, please?
>
> I still have it in zombie state, attachment is sysrq-t dump saved from
> /var/log/message (seems not easy to read..).
Hmmm... xfs_scrub process 23562 is in the midst of executing a getfsmap
command. It is in the midst of processing an rmap record and is
cross-referencing it with the refcountbt to find out if the mapping is
shared. However, the refcountbt access is stuck on a buffer lock
attempt. This could be because 1312 corrupts the refcountbt, which
could lead to a loop in the metadata; when this happens, we can
self-deadlock.
Come to think of it, I reorganized the getfsmap code to grab all the
buffers in transaction context so that we avoid self-deadlock (because
we can always re-grab a buffer we've locked to a transaction that we
own), but I see that xfs_getfsmap_is_shared does not pass this
transaction through to the refcountbt cursor and therefore does not take
advantage of the anti-deadlock provisions.
In the morning I'll go make it do that.
PS: In theory if you capture the xfs_buf*lock ftraces, you can feed the
report output into tools/xfsbuflock.py which will look for deadlocks.
Not recommended for long jobs, though.
> > > And in most tests I have run, I see such failures:
> > >
> > > +scrub didn't fail with length = ones.
> > > +scrub didn't fail with length = firstbit.
> > > +scrub didn't fail with length = middlebit.
> > > +scrub didn't fail with length = lastbit.
> > > ....
> > >
> > > Not sure if that's expected?
> >
> > Yes, that's expected. The scrub routines expect that the repairing
> > program (xfs_{scrub,repair}) will complain about the corrupt field,
> > repair it, and a subsequent re-run will exit cleanly. There are quite a
> > few fields like uid/gid and timestamps that have no inherent meaning to
> > XFS. As a result, there's no problem to be detected. Some of the
> > fuzzes will prevent the fs from mounting, which causes other error
> > messages.
> >
> > The rest could be undiagnosed problems in other parts of XFS (or scrub).
> > I've not had time to triage a lot of it. I've been recording exactly
> > what and where things fail and I'll have a look at them as time allows.
> >
> > > I also hit xfs_scrub and xfs_repair double free bug in xfs/1312 (perhaps
> > > that's why I can't kill it).
> >
> > Maybe. In theory the page refcounts get reset, I think, but I've seen
> > the VM crash with double-fault errors and other weirdness that seem to
> > go away when the refcount bugs go away.
> >
> > > OTOH, all these failures/issues seem like kernel or userspace bug, I
> > > went through all the patches and new tests and I didn't find anything
> > > wrong obviously. So I think it's fine to merge them in this week's
> > > update. Unless you have a second thought?
> >
> > Sure. I will never enable them in any of the heavily used groups, so
> > that should be fine. Though I do have a request -- the 13xx numbers are
> > set up so that if test (1300+x) fuzzes object X and tries to xfs_repair
> > it, then test (1340+x) fuzzes the same X but tries to xfs_scrub it.
> > Could you interweave them when you renumber the tests?
>
> Perhaps that explains why there's no 1336-1340 :)
Yep.
> >
> > e.g. 1302 -> 510, 1342 -> 511, 1303 -> 512, 1343 -> 513?
> >
> > That'll help me to keep together the repair & scrub fuzz tests.
>
> Sure, I'll renumber the tests and let you review first before pushing
> them to upstream.
Ok, thanks! I really appreciate it!
--D
>
> Thanks,
> Eryu
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v5 0/9] xfstests: online scrub/repair support
2017-01-26 7:53 ` Darrick J. Wong
@ 2017-01-27 1:41 ` Eryu Guan
2017-01-27 9:22 ` Darrick J. Wong
0 siblings, 1 reply; 22+ messages in thread
From: Eryu Guan @ 2017-01-27 1:41 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-xfs, fstests
On Wed, Jan 25, 2017 at 11:53:23PM -0800, Darrick J. Wong wrote:
> > > Sure. I will never enable them in any of the heavily used groups, so
> > > that should be fine. Though I do have a request -- the 13xx numbers are
> > > set up so that if test (1300+x) fuzzes object X and tries to xfs_repair
> > > it, then test (1340+x) fuzzes the same X but tries to xfs_scrub it.
> > > Could you interweave them when you renumber the tests?
> >
> > Perhaps that explains why there's no 1336-1340 :)
>
> Yep.
>
> > >
> > > e.g. 1302 -> 510, 1342 -> 511, 1303 -> 512, 1343 -> 513?
> > >
> > > That'll help me to keep together the repair & scrub fuzz tests.
> >
> > Sure, I'll renumber the tests and let you review first before pushing
> > them to upstream.
>
> Ok, thanks! I really appreciate it!
This is what it's like after renumbering, I'm going to fold it to patch
9/9 if you think it's OK.
Moved "xfs/1300" to "xfs/349"
Moved "xfs/1301" to "xfs/350".
Moved "xfs/1302" to "xfs/352".
Moved "xfs/1303" to "xfs/354".
Moved "xfs/1304" to "xfs/356".
Moved "xfs/1305" to "xfs/358".
Moved "xfs/1306" to "xfs/360".
Moved "xfs/1307" to "xfs/362".
Moved "xfs/1308" to "xfs/364".
Moved "xfs/1309" to "xfs/366".
Moved "xfs/1310" to "xfs/368".
Moved "xfs/1311" to "xfs/370".
Moved "xfs/1312" to "xfs/372".
Moved "xfs/1313" to "xfs/374".
Moved "xfs/1314" to "xfs/376".
Moved "xfs/1315" to "xfs/378".
Moved "xfs/1316" to "xfs/380".
Moved "xfs/1317" to "xfs/382".
Moved "xfs/1318" to "xfs/384".
Moved "xfs/1319" to "xfs/386".
Moved "xfs/1320" to "xfs/388".
Moved "xfs/1321" to "xfs/390".
Moved "xfs/1322" to "xfs/392".
Moved "xfs/1323" to "xfs/394".
Moved "xfs/1324" to "xfs/396".
Moved "xfs/1325" to "xfs/398".
Moved "xfs/1326" to "xfs/400".
Moved "xfs/1327" to "xfs/402".
Moved "xfs/1328" to "xfs/404".
Moved "xfs/1329" to "xfs/406".
Moved "xfs/1330" to "xfs/408".
Moved "xfs/1331" to "xfs/410".
Moved "xfs/1332" to "xfs/412".
Moved "xfs/1333" to "xfs/414".
Moved "xfs/1334" to "xfs/416".
Moved "xfs/1335" to "xfs/418".
Moved "xfs/1341" to "xfs/351".
Moved "xfs/1342" to "xfs/353".
Moved "xfs/1343" to "xfs/355".
Moved "xfs/1344" to "xfs/357".
Moved "xfs/1345" to "xfs/359".
Moved "xfs/1346" to "xfs/361".
Moved "xfs/1347" to "xfs/363".
Moved "xfs/1348" to "xfs/365".
Moved "xfs/1349" to "xfs/367".
Moved "xfs/1350" to "xfs/369".
Moved "xfs/1351" to "xfs/371".
Moved "xfs/1352" to "xfs/373".
Moved "xfs/1353" to "xfs/375".
Moved "xfs/1354" to "xfs/377".
Moved "xfs/1355" to "xfs/379".
Moved "xfs/1356" to "xfs/381".
Moved "xfs/1357" to "xfs/383".
Moved "xfs/1358" to "xfs/385".
Moved "xfs/1359" to "xfs/387".
Moved "xfs/1360" to "xfs/389".
Moved "xfs/1361" to "xfs/391".
Moved "xfs/1362" to "xfs/393".
Moved "xfs/1363" to "xfs/395".
Moved "xfs/1364" to "xfs/397".
Moved "xfs/1365" to "xfs/399".
Moved "xfs/1366" to "xfs/401".
Moved "xfs/1367" to "xfs/403".
Moved "xfs/1368" to "xfs/405".
Moved "xfs/1369" to "xfs/407".
Moved "xfs/1370" to "xfs/409".
Moved "xfs/1371" to "xfs/411".
Moved "xfs/1372" to "xfs/413".
Moved "xfs/1373" to "xfs/415".
Moved "xfs/1374" to "xfs/417".
Thanks,
Eryu
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 5/9] common/fuzzy: move fuzzing helper functions here
2017-01-21 8:10 ` [PATCH 5/9] common/fuzzy: move fuzzing helper functions here Darrick J. Wong
@ 2017-01-27 8:12 ` Eryu Guan
2017-01-27 9:24 ` Darrick J. Wong
0 siblings, 1 reply; 22+ messages in thread
From: Eryu Guan @ 2017-01-27 8:12 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-xfs, fstests
On Sat, Jan 21, 2017 at 12:10:50AM -0800, Darrick J. Wong wrote:
> Move some fuzzing helper functions into a new common/fuzzy file.
> We'll add a lot more fuzzing helpers in subsequent patches.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> common/fuzzy | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> common/populate | 35 ------------------------
> tests/ext4/006 | 1 +
> tests/xfs/083 | 1 +
> 4 files changed, 82 insertions(+), 35 deletions(-)
> create mode 100644 common/fuzzy
>
>
> diff --git a/common/fuzzy b/common/fuzzy
> new file mode 100644
> index 0000000..d4f8274
> --- /dev/null
> +++ b/common/fuzzy
> @@ -0,0 +1,80 @@
...
> +# Try to access files after fuzzing
> +_scratch_fuzz_test() {
> + echo "+++ ls -laR" >> $seqres.full
> + ls -laR "${SCRATCH_MNT}/test.1/" >/dev/null 2>&1
> +
> + echo "+++ cat files" >> $seqres.full
> + (find "${SCRATCH_MNT}/test.1/" -type f -size -1048576k -print0 | xargs -0 cat) >/dev/null 2>&1
> +}
> +
> +# Do we have an online scrub program?
> +_require_scrub() {
> + case "${FSTYP}" in
> + "xfs"|"ext4")
> + test -x $XFS_SCRUB_PROG || _notrun "xfs_scrub not found"
In my release testing I found ext4/023 (moved from ext4/1300) failed due
to lack of xfs_scrub, because "test -x " returns true, (but "test -x ''"
doesn't), so I add quotes around $XFS_SCRUB_PROG and fold the update
into this patch.
Thanks,
Eryu
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v5 0/9] xfstests: online scrub/repair support
2017-01-27 1:41 ` Eryu Guan
@ 2017-01-27 9:22 ` Darrick J. Wong
0 siblings, 0 replies; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-27 9:22 UTC (permalink / raw)
To: Eryu Guan; +Cc: linux-xfs, fstests
On Fri, Jan 27, 2017 at 09:41:46AM +0800, Eryu Guan wrote:
> On Wed, Jan 25, 2017 at 11:53:23PM -0800, Darrick J. Wong wrote:
>
> > > > Sure. I will never enable them in any of the heavily used groups, so
> > > > that should be fine. Though I do have a request -- the 13xx numbers are
> > > > set up so that if test (1300+x) fuzzes object X and tries to xfs_repair
> > > > it, then test (1340+x) fuzzes the same X but tries to xfs_scrub it.
> > > > Could you interweave them when you renumber the tests?
> > >
> > > Perhaps that explains why there's no 1336-1340 :)
> >
> > Yep.
> >
> > > >
> > > > e.g. 1302 -> 510, 1342 -> 511, 1303 -> 512, 1343 -> 513?
> > > >
> > > > That'll help me to keep together the repair & scrub fuzz tests.
> > >
> > > Sure, I'll renumber the tests and let you review first before pushing
> > > them to upstream.
> >
> > Ok, thanks! I really appreciate it!
>
> This is what it's like after renumbering, I'm going to fold it to patch
> 9/9 if you think it's OK.
>
>
> Moved "xfs/1300" to "xfs/349"
>
> Moved "xfs/1301" to "xfs/350".
> Moved "xfs/1302" to "xfs/352".
> Moved "xfs/1303" to "xfs/354".
> Moved "xfs/1304" to "xfs/356".
> Moved "xfs/1305" to "xfs/358".
> Moved "xfs/1306" to "xfs/360".
> Moved "xfs/1307" to "xfs/362".
> Moved "xfs/1308" to "xfs/364".
> Moved "xfs/1309" to "xfs/366".
> Moved "xfs/1310" to "xfs/368".
> Moved "xfs/1311" to "xfs/370".
> Moved "xfs/1312" to "xfs/372".
> Moved "xfs/1313" to "xfs/374".
> Moved "xfs/1314" to "xfs/376".
> Moved "xfs/1315" to "xfs/378".
> Moved "xfs/1316" to "xfs/380".
> Moved "xfs/1317" to "xfs/382".
> Moved "xfs/1318" to "xfs/384".
> Moved "xfs/1319" to "xfs/386".
> Moved "xfs/1320" to "xfs/388".
> Moved "xfs/1321" to "xfs/390".
> Moved "xfs/1322" to "xfs/392".
> Moved "xfs/1323" to "xfs/394".
> Moved "xfs/1324" to "xfs/396".
> Moved "xfs/1325" to "xfs/398".
> Moved "xfs/1326" to "xfs/400".
> Moved "xfs/1327" to "xfs/402".
> Moved "xfs/1328" to "xfs/404".
> Moved "xfs/1329" to "xfs/406".
> Moved "xfs/1330" to "xfs/408".
> Moved "xfs/1331" to "xfs/410".
> Moved "xfs/1332" to "xfs/412".
> Moved "xfs/1333" to "xfs/414".
> Moved "xfs/1334" to "xfs/416".
> Moved "xfs/1335" to "xfs/418".
>
> Moved "xfs/1341" to "xfs/351".
> Moved "xfs/1342" to "xfs/353".
> Moved "xfs/1343" to "xfs/355".
> Moved "xfs/1344" to "xfs/357".
> Moved "xfs/1345" to "xfs/359".
> Moved "xfs/1346" to "xfs/361".
> Moved "xfs/1347" to "xfs/363".
> Moved "xfs/1348" to "xfs/365".
> Moved "xfs/1349" to "xfs/367".
> Moved "xfs/1350" to "xfs/369".
> Moved "xfs/1351" to "xfs/371".
> Moved "xfs/1352" to "xfs/373".
> Moved "xfs/1353" to "xfs/375".
> Moved "xfs/1354" to "xfs/377".
> Moved "xfs/1355" to "xfs/379".
> Moved "xfs/1356" to "xfs/381".
> Moved "xfs/1357" to "xfs/383".
> Moved "xfs/1358" to "xfs/385".
> Moved "xfs/1359" to "xfs/387".
> Moved "xfs/1360" to "xfs/389".
> Moved "xfs/1361" to "xfs/391".
> Moved "xfs/1362" to "xfs/393".
> Moved "xfs/1363" to "xfs/395".
> Moved "xfs/1364" to "xfs/397".
> Moved "xfs/1365" to "xfs/399".
> Moved "xfs/1366" to "xfs/401".
> Moved "xfs/1367" to "xfs/403".
> Moved "xfs/1368" to "xfs/405".
> Moved "xfs/1369" to "xfs/407".
> Moved "xfs/1370" to "xfs/409".
> Moved "xfs/1371" to "xfs/411".
> Moved "xfs/1372" to "xfs/413".
> Moved "xfs/1373" to "xfs/415".
> Moved "xfs/1374" to "xfs/417".
Looks fine, thanks!
--D
>
> Thanks,
> Eryu
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 5/9] common/fuzzy: move fuzzing helper functions here
2017-01-27 8:12 ` Eryu Guan
@ 2017-01-27 9:24 ` Darrick J. Wong
0 siblings, 0 replies; 22+ messages in thread
From: Darrick J. Wong @ 2017-01-27 9:24 UTC (permalink / raw)
To: Eryu Guan; +Cc: linux-xfs, fstests
On Fri, Jan 27, 2017 at 04:12:11PM +0800, Eryu Guan wrote:
> On Sat, Jan 21, 2017 at 12:10:50AM -0800, Darrick J. Wong wrote:
> > Move some fuzzing helper functions into a new common/fuzzy file.
> > We'll add a lot more fuzzing helpers in subsequent patches.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > common/fuzzy | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > common/populate | 35 ------------------------
> > tests/ext4/006 | 1 +
> > tests/xfs/083 | 1 +
> > 4 files changed, 82 insertions(+), 35 deletions(-)
> > create mode 100644 common/fuzzy
> >
> >
> > diff --git a/common/fuzzy b/common/fuzzy
> > new file mode 100644
> > index 0000000..d4f8274
> > --- /dev/null
> > +++ b/common/fuzzy
> > @@ -0,0 +1,80 @@
> ...
> > +# Try to access files after fuzzing
> > +_scratch_fuzz_test() {
> > + echo "+++ ls -laR" >> $seqres.full
> > + ls -laR "${SCRATCH_MNT}/test.1/" >/dev/null 2>&1
> > +
> > + echo "+++ cat files" >> $seqres.full
> > + (find "${SCRATCH_MNT}/test.1/" -type f -size -1048576k -print0 | xargs -0 cat) >/dev/null 2>&1
> > +}
> > +
> > +# Do we have an online scrub program?
> > +_require_scrub() {
> > + case "${FSTYP}" in
> > + "xfs"|"ext4")
> > + test -x $XFS_SCRUB_PROG || _notrun "xfs_scrub not found"
>
> In my release testing I found ext4/023 (moved from ext4/1300) failed due
> to lack of xfs_scrub, because "test -x " returns true, (but "test -x ''"
> doesn't), so I add quotes around $XFS_SCRUB_PROG and fold the update
> into this patch.
Oops! Thanks for fixing this.
--D
>
> Thanks,
> Eryu
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2017-01-27 9:24 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-21 8:10 [PATCH v5 0/9] xfstests: online scrub/repair support Darrick J. Wong
2017-01-21 8:10 ` [PATCH 1/9] populate: create all types of XFS metadata Darrick J. Wong
2017-01-21 8:10 ` [PATCH 2/9] populate: add _require_populate_commands to check for tools Darrick J. Wong
2017-01-21 8:10 ` [PATCH 3/9] populate: optionally fill the filesystem when populating fs Darrick J. Wong
2017-01-21 8:10 ` [PATCH 4/9] populate: fix some silly errors when modifying a fs while fuzzing Darrick J. Wong
2017-01-21 8:10 ` [PATCH 5/9] common/fuzzy: move fuzzing helper functions here Darrick J. Wong
2017-01-27 8:12 ` Eryu Guan
2017-01-27 9:24 ` Darrick J. Wong
2017-01-21 8:10 ` [PATCH 6/9] populate: cache scratch metadata images Darrick J. Wong
2017-01-21 8:11 ` [PATCH 7/9] populate: discover XFS structure fields and fuzz verbs, and use them to fuzz fields Darrick J. Wong
2017-01-21 8:11 ` [PATCH 8/9] common/populate: create attrs in different namespaces Darrick J. Wong
[not found] ` <CAOQ4uxgDPEQiC72-o7yt0P6o2xdVTb6kQNxoePOzYWRbCCXxKw@mail.gmail.com>
2017-01-22 5:01 ` [PATCH v5 0/9] xfstests: online scrub/repair support Darrick J. Wong
2017-01-22 6:10 ` Amir Goldstein
2017-01-26 5:08 ` Eryu Guan
2017-01-26 6:44 ` Darrick J. Wong
2017-01-26 7:26 ` Eryu Guan
2017-01-26 7:53 ` Darrick J. Wong
2017-01-27 1:41 ` Eryu Guan
2017-01-27 9:22 ` Darrick J. Wong
-- strict thread matches above, loose matches on Subject: below --
2017-01-05 1:17 [PATCH v4 " Darrick J. Wong
2017-01-05 1:17 ` [PATCH 5/9] common/fuzzy: move fuzzing helper functions here Darrick J. Wong
2017-01-10 23:32 ` Darrick J. Wong
2016-11-05 0:17 [PATCH v2 0/9] xfstests: online scrub/repair support Darrick J. Wong
2016-11-05 0:17 ` [PATCH 5/9] common/fuzzy: move fuzzing helper functions here Darrick J. Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox