xfs/424: test xfs_db to ensure sector size taken into account with new type
PATCH 1/1 xfs/424: test xfs_db to ensure sector size taken into account with new type
xfs_db should take sector size into account when setting type. If sector size ignored, a false crc error can occur due to the new size not being picked up when type gets set. This test checks for that false crc error.
--- tests/xfs/424 | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 5 ++++ tests/xfs/group | 1 + 3 files changed, 78 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.out
tests/xfs/424 new file +72 -0
@@ -0,0 +1,72 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take sector size into account when setting type. +# If sector size ignored, a false crc error can occur due to +# the new size not being picked up when type is set. This test +# checks for that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_scratch_unmount >> $seqres.full 2>&1 + +# for different sector sizes, ensure no CRC errors are falsely reported +$MKFS_PROG -t xfs -f -s size=512 $SCRATCH_DEV > /dev/null +$XFS_DB_PROG -c "agi 0" -c "daddr" -c "daddr 42" -c "daddr 2" -c "type agi" $SCRATCH_DEV + +$MKFS_PROG -t xfs -f -s size=1024 $SCRATCH_DEV > /dev/null +$XFS_DB_PROG -c "agi 0" -c "daddr" -c "daddr 42" -c "daddr 4" -c "type agi" $SCRATCH_DEV + +$MKFS_PROG -t xfs -f -s size=2048 $SCRATCH_DEV > /dev/null +$XFS_DB_PROG -c "agi 0" -c "daddr" -c "daddr 42" -c "daddr 8" -c "type agi" $SCRATCH_DEV + +$MKFS_PROG -t xfs -f -s size=4096 $SCRATCH_DEV > /dev/null +$XFS_DB_PROG -c "agi 0" -c "daddr" -c "daddr 42" -c "daddr 16" -c "type agi" $SCRATCH_DEV + +# Modify as appropriate. +_supported_fs generic +_supported_os Linux +_require_test + +# success, all done +status=0 +exit
tests/xfs/424.out new file +5 -0
@@ -0,0 +1,5 @@ +QA output created by 424 +current daddr is 2 +current daddr is 4 +current daddr is 8 +current daddr is 16
tests/xfs/group +1 -0
@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick db
Signature · 1 line
2.13.0
Quoted 1 line · Bill O'Donnell
xfs_dbshould take sector size into account when setting type.
type size. Sector size just happens to influence some type sizes.
Quoted 59 lines
If sector size ignored, a false crc error can occur due to the new size not being picked up when type gets set. This test checks for that false crc error.
Signed-off-by Bill O'Donnell <[email protected]>--- tests/xfs/424 | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 5 ++++ tests/xfs/group | 1 + 3 files changed, 78 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.outtests/xfs/424 new file +40
-0@@ -0,0 +1,72 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take sector size into account when setting type. +# If sector size ignored, a false crc error can occur due to +# the new size not being picked up when type is set. This test +# checks for that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +}
tests/xfs/424 line 50
Quoted 10 lines
tests/xfs/424 new file +10
-0+ +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_scratch_unmount >> $seqres.full 2>&1
Scratch should be unmounted already, maybe it's ok to be defensive.
tests/xfs/424 line 53
Quoted 3 lines
tests/xfs/424 new file +3
-0+ +# for different sector sizes, ensure no CRC errors are falsely reported +$MKFS_PROG -t xfs -f -s size=512 $SCRATCH_DEV > /dev/null
Could also just use $MKFS_XFS_PROG, but *shrug*
tests/xfs/424 line 54
Quoted 1 line
tests/xfs/424 new file +1
-0+$XFS_DB_PROG -c "agi 0" -c "daddr" -c "daddr 42" -c "daddr 2" -c "type agi" $SCRATCH_DEV
While it's probably safe in this instance, because:
#define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log))
hardcoding the agi 0 location feels a little fragile. If this were testing various types, it would be safest to do i.e. "agf 0; daddr" and collect the computed disk address, then set it back to the daddr reported by db...
tests/xfs/424 line 63
Quoted 7 lines
tests/xfs/424 new file +7
-0+ack"daddr" -c "daddr 42" -c "daddr 4" -c "type agi" $SCRATCH_DEV + +$MKFS_PROG -t xfs -f -s size=2048 $SCRATCH_DEV > /dev/null +$XFS_DB_PROG -c "agi 0" -c "daddr" -c "daddr 42" -c "daddr 8" -c "type agi" $SCRATCH_DEV + +$MKFS_PROG -t xfs -f -s size=4096 $SCRATCH_DEV > /dev/null +$XFS_DB_PROG -c "agi 0" -c "daddr" -c "daddr 42" -c "daddr 16" -c "type agi" $SCRATCH_DEV
Is it sufficient to only test agi types?
tests/xfs/424 line 63
Quoted 2 lines
tests/xfs/424 new file +2
-0+ +# Modify as appropriate.
Surely all the requirements should go prior to the actual testing above?
tests/xfs/424 line 66
Quoted 1 line
tests/xfs/424 new file +1
-0+_supported_fs generic
I doubt that this works on generic filesystems. xfs, right?
tests/xfs/424 line 68
Quoted 2 lines
tests/xfs/424 new file +2
-0+_supported_os Linux +_require_test
why do you need a test dev? On the other hand, you /do/ need a scratch dev ...
thanks,
-eric
Quoted 25 lines
tests/xfs/424 new file +4
-0+ +# success, all done +status=0 +exittests/xfs/424.out new file +5
-0@@ -0,0 +1,5 @@ +QA output created by 424 +current daddr is 2 +current daddr is 4 +current daddr is 8 +current daddr is 16tests/xfs/group +1
-0@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick db
PATCH 1/1 xfs/424: test xfs_db to ensure type size taken into account with new type
In reply to Bill O'Donnellxfs_db should take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error.
---
v2: Clarify commit message and test comments. Add a few more test cases.
tests/xfs/424 | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 1 + tests/xfs/group | 1 + 3 files changed, 79 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.out
tests/xfs/424 new file +77 -0
@@ -0,0 +1,77 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +_filter_dbval() +{ + awk '{ print $4 }' +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux +_require_scratch + +# real QA test starts here +_scratch_unmount >> $seqres.full 2>&1 + +# for different sector sizes, ensure no CRC errors are falsely reported + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt. +# For various sector sizes, test some types that involve type size. +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + for TYPE in agf agi agfl sb; do + DADDR=`$XFS_DB_PROG -c "$TYPE" -c "daddr" $SCRATCH_DEV | _filter_dbval` + $XFS_DB_PROG -c "$TYPE" -c "daddr 42" -c "daddr $DADDR" -c "type $TYPE" $SCRATCH_DEV + done +done + +# success, all done +status=0 +exit
tests/xfs/424.out new file +1 -0
@@ -0,0 +1 @@ +QA output created by 424
tests/xfs/group +1 -0
@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick db
Signature · 1 line
2.13.0
Re: [PATCH] xfs/424: test xfs_db to ensure type size taken into account with new type
Quoted 67 lines · Bill O'Donnell
xfs_dbshould take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error.Signed-off-by Bill O'Donnell <[email protected]>---
v2: Clarify commit message and test comments. Add a few more test cases.tests/xfs/424 | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 1 + tests/xfs/group | 1 + 3 files changed, 79 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.outtests/xfs/424 new file +45
-0@@ -0,0 +1,77 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +_filter_dbval() +{ + awk '{ print $4 }' +}
tests/xfs/424 line 55
Quoted 10 lines
tests/xfs/424 new file +10
-0+ +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux
_supported_fs xfs
tests/xfs/424 line 65
Quoted 10 lines
tests/xfs/424 new file +10
-0+_require_scratch + +# real QA test starts here +_scratch_unmount >> $seqres.full 2>&1 + +# for different sector sizes, ensure no CRC errors are falsely reported + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt.
This leaves me wondering why we don't test most of the above ;)
tests/xfs/424 line 71
Quoted 6 lines
tests/xfs/424 new file +6
-0+# For various sector sizes, test some types that involve type size. +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + for TYPE in agf agi agfl sb; do + DADDR=`$XFS_DB_PROG -c "$TYPE" -c "daddr" $SCRATCH_DEV | _filter_dbval` + $XFS_DB_PROG -c "$TYPE" -c "daddr 42" -c "daddr $DADDR" -c "type $TYPE" $SCRATCH_DEV
Hm is there a reason for the first "-c $TYPE" or even the "daddr 42" in the line just above?
Interesting, I didn't know that a bare "agf" works, but it does (and is documented as such). fair enough.
It'd be very easy to add just a few more types to this, i.e.: (leaving the extra
type & daddr setting in place for now)
DADDR=$XFS_DB_PROG -c "sb" -c "addr rootino" -c "daddr" $SCRATCH_DEV | _filter_dbval $XFS_DB_PROG -c "type inode" -c "daddr 42" -c "daddr $DADDR" -c "type inode" $SCRATCH_DEV
DADDR=$XFS_DB_PROG -c "agf" -c "addr bnoroot" -c "daddr" $SCRATCH_DEV | _filter_dbval $XFS_DB_PROG -c "type bnobt" -c "daddr 42" -c "daddr $DADDR" -c "type bnobt" $SCRATCH_DEV
DADDR=$XFS_DB_PROG -c "agf" -c "addr cntroot" -c "daddr" $SCRATCH_DEV | _filter_dbval $XFS_DB_PROG -c "type cntbt" -c "daddr 42" -c "daddr $DADDR" -c "type cntbt" $SCRATCH_DEV
DADDR=$XFS_DB_PROG -c "agi" -c "addr root" -c "daddr" $SCRATCH_DEV | _filter_dbval $XFS_DB_PROG -c "type inobt" -c "daddr 42" -c "daddr $DADDR" -c "type inobt" $SCRATCH_DEV
DADDR=$XFS_DB_PROG -c "agi" -c "addr free_root" -c "daddr" $SCRATCH_DEV | _filter_dbval $XFS_DB_PROG -c "type finobt" -c "daddr 42" -c "daddr $DADDR" -c "type finobt" $SCRATCH_DEV
others such as attr, dir, symlink would require more filesystem preparation I guess.
Thanks,
-Eric
Quoted 23 lines
tests/xfs/424 new file +6
-0+ done +done + +# success, all done +status=0 +exittests/xfs/424.out new file +1
-0@@ -0,0 +1 @@ +QA output created by 424tests/xfs/group +1
-0@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick db
Re: [PATCH] xfs/424: test xfs_db to ensure type size taken into account with new type
Quoted 96 lines · Eric Sandeen
Quoted 67 lines · Bill O'Donnell
xfs_dbshould take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error.Signed-off-by Bill O'Donnell <[email protected]>---
v2: Clarify commit message and test comments. Add a few more test cases.tests/xfs/424 | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 1 + tests/xfs/group | 1 + 3 files changed, 79 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.outtests/xfs/424 new file +45
-0@@ -0,0 +1,77 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +_filter_dbval() +{ + awk '{ print $4 }' +}tests/xfs/424 line 55
Quoted 10 lines
tests/xfs/424 new file +10
-0+ +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux
_supported_fsxfstests/xfs/424 line 65
Quoted 10 lines
tests/xfs/424 new file +10
-0+_require_scratch + +# real QA test starts here +_scratch_unmount >> $seqres.full 2>&1 + +# for different sector sizes, ensure no CRC errors are falsely reported + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt.This leaves me wondering why we don't test most of the above ;)
Quoted 8 lines
tests/xfs/424 line 71
Quoted 6 lines
tests/xfs/424 new file +6
-0+# For various sector sizes, test some types that involve type size. +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + for TYPE in agf agi agfl sb; do + DADDR=`$XFS_DB_PROG -c "$TYPE" -c "daddr" $SCRATCH_DEV | _filter_dbval` + $XFS_DB_PROG -c "$TYPE" -c "daddr 42" -c "daddr $DADDR" -c "type $TYPE" $SCRATCH_DEVHm is there a reason for the first "-c $TYPE" or even the "daddr 42" in the line just above?
It's drawn from the reproducer test case.
The first "-c $TYPE" sets the object, "daddr 42" is an arbitrary address set. Without the daddr change and change-back, the test will pass even without the recent xfs_db xfsprogs change.
Quoted 6 lines
Interesting, I didn't know that a bare "agf" works, but it does (and is documented as such). fair enough.
It'd be very easy to add just a few more types to this, i.e.: (leaving the extra
type & daddr setting in place for now)
ok. I'll add a few more.
Quoted 44 lines
DADDR=
$XFS_DB_PROG -c "sb" -c "addr rootino" -c "daddr" $SCRATCH_DEV | _filter_dbval$XFS_DB_PROG -c "type inode" -c "daddr 42" -c "daddr $DADDR" -c "type inode" $SCRATCH_DEVDADDR=
$XFS_DB_PROG -c "agf" -c "addr bnoroot" -c "daddr" $SCRATCH_DEV | _filter_dbval$XFS_DB_PROG -c "type bnobt" -c "daddr 42" -c "daddr $DADDR" -c "type bnobt" $SCRATCH_DEVDADDR=
$XFS_DB_PROG -c "agf" -c "addr cntroot" -c "daddr" $SCRATCH_DEV | _filter_dbval$XFS_DB_PROG -c "type cntbt" -c "daddr 42" -c "daddr $DADDR" -c "type cntbt" $SCRATCH_DEVDADDR=
$XFS_DB_PROG -c "agi" -c "addr root" -c "daddr" $SCRATCH_DEV | _filter_dbval$XFS_DB_PROG -c "type inobt" -c "daddr 42" -c "daddr $DADDR" -c "type inobt" $SCRATCH_DEVDADDR=
$XFS_DB_PROG -c "agi" -c "addr free_root" -c "daddr" $SCRATCH_DEV | _filter_dbval$XFS_DB_PROG -c "type finobt" -c "daddr 42" -c "daddr $DADDR" -c "type finobt" $SCRATCH_DEVothers such as attr, dir, symlink would require more filesystem preparation I guess.
Thanks,
-EricQuoted 23 lines
tests/xfs/424 new file +6
-0+ done +done + +# success, all done +status=0 +exittests/xfs/424.out new file +1
-0@@ -0,0 +1 @@ +QA output created by 424tests/xfs/group +1
-0@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick db
Re: [PATCH] xfs/424: test xfs_db to ensure type size taken into account with new type
Quoted 19 lines · Bill O'Donnell
Quoted 8 lines · Eric Sandeen
tests/xfs/424 line 65
Quoted 5 lines
tests/xfs/424 new file +5
-0+# for different sector sizes, ensure no CRC errors are falsely reported + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt.This leaves me wondering why we don't test most of the above ;)
Quoted 8 lines
tests/xfs/424 line 71
Quoted 6 lines
tests/xfs/424 new file +6
-0+# For various sector sizes, test some types that involve type size. +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + for TYPE in agf agi agfl sb; do + DADDR=`$XFS_DB_PROG -c "$TYPE" -c "daddr" $SCRATCH_DEV | _filter_dbval` + $XFS_DB_PROG -c "$TYPE" -c "daddr 42" -c "daddr $DADDR" -c "type $TYPE" $SCRATCH_DEVHm is there a reason for the first "-c $TYPE" or even the "daddr 42" in the line just above?
Quoted 4 lines
It's drawn from the reproducer test case.
The first "-c $TYPE" sets the object, "daddr 42" is an arbitrary address set. Without the daddr change and change-back, the test will pass even without the recentxfs_dbxfsprogs change.
Really? Not here, xfsprogs-4.5.0 :
# xfs_db -c "daddr 2" -c "type agi" fsfile Metadata CRC error detected at xfs_agi block 0x2/0x200
-Eric
Re: [PATCH] xfs/424: test xfs_db to ensure type size taken into account with new type
Quoted 27 lines · Eric Sandeen
Quoted 19 lines · Bill O'Donnell
Quoted 8 lines · Eric Sandeen
tests/xfs/424 line 65
Quoted 5 lines
tests/xfs/424 new file +5
-0+# for different sector sizes, ensure no CRC errors are falsely reported + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt.This leaves me wondering why we don't test most of the above ;)
Quoted 8 lines
tests/xfs/424 line 71
Quoted 6 lines
tests/xfs/424 new file +6
-0+# For various sector sizes, test some types that involve type size. +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + for TYPE in agf agi agfl sb; do + DADDR=`$XFS_DB_PROG -c "$TYPE" -c "daddr" $SCRATCH_DEV | _filter_dbval` + $XFS_DB_PROG -c "$TYPE" -c "daddr 42" -c "daddr $DADDR" -c "type $TYPE" $SCRATCH_DEVHm is there a reason for the first "-c $TYPE" or even the "daddr 42" in the line just above?
Quoted 4 lines
It's drawn from the reproducer test case.
The first "-c $TYPE" sets the object, "daddr 42" is an arbitrary address set. Without the daddr change and change-back, the test will pass even without the recentxfs_dbxfsprogs change.
Quoted 4 lines
Really? Not here, xfsprogs-4.5.0 :
# xfs_db -c "daddr 2" -c "type agi" fsfile Metadata CRC error detected at xfs_agi block 0x2/0x200
Ahh, ok, you're correct - I'll modify the test accordingly. Thanks-
Bill
Quoted 3 lines
-Eric
Re: [PATCH] xfs/424: test xfs_db to ensure type size taken into account with new type
Quoted 28 lines · Bill O'Donnell
Quoted 27 lines · Eric Sandeen
Quoted 23 lines · Bill O'Donnell
Quoted 8 lines · Eric Sandeen
tests/xfs/424 line 65
Quoted 5 lines
tests/xfs/424 new file +5
-0+# for different sector sizes, ensure no CRC errors are falsely reported + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt.This leaves me wondering why we don't test most of the above ;)
Quoted 8 lines
tests/xfs/424 line 71
Quoted 6 lines
tests/xfs/424 new file +6
-0+# For various sector sizes, test some types that involve type size. +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + for TYPE in agf agi agfl sb; do + DADDR=`$XFS_DB_PROG -c "$TYPE" -c "daddr" $SCRATCH_DEV | _filter_dbval` + $XFS_DB_PROG -c "$TYPE" -c "daddr 42" -c "daddr $DADDR" -c "type $TYPE" $SCRATCH_DEVHm is there a reason for the first "-c $TYPE" or even the "daddr 42" in the line just above?
It's drawn from the reproducer test case.
The first "-c $TYPE" sets the object, "daddr 42" is an arbitrary address set. Without the daddr change and change-back, the test will pass even without the recentxfs_dbxfsprogs change.
Quoted 6 lines
Quoted 4 lines
Really? Not here, xfsprogs-4.5.0 :
# xfs_db -c "daddr 2" -c "type agi" fsfile Metadata CRC error detected at xfs_agi block 0x2/0x200Ahh, ok, you're correct - I'll modify the test accordingly.
Wait. I still think the object has to get set with "-c $TYPE". If not the crc error occurs even with the new xfs_db code:
# xfs_db -V xfs_db version 4.12.0-rc2 # xfs_db /dev/sda6 xfs_db> daddr current daddr is 0 xfs_db> daddr 2 xfs_db> type agi Metadata CRC error detected at xfs_agi block 0x2/0x1000 Metadata CRC error detected at xfs_agi block 0x2/0x1000
And error is gone when the object is set and the daddr gets set to the correct value.
[root@localhost xfsprogs-dev3]# xfs_db /dev/sda6 xfs_db> agixfs_db> daddr
current daddr is 16xfs_db> daddr 2xfs_db> daddr 16xfs_db> type agi
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] xfs/424: test xfs_db to ensure type size taken into account with new type
Quoted 38 lines · Bill O'Donnell
Quoted 28 lines · Bill O'Donnell
Quoted 27 lines · Eric Sandeen
Quoted 23 lines · Bill O'Donnell
Quoted 8 lines · Eric Sandeen
tests/xfs/424 line 65
Quoted 5 lines
tests/xfs/424 new file +5
-0+# for different sector sizes, ensure no CRC errors are falsely reported + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt.This leaves me wondering why we don't test most of the above ;)
Quoted 8 lines
tests/xfs/424 line 71
Quoted 6 lines
tests/xfs/424 new file +6
-0+# For various sector sizes, test some types that involve type size. +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + for TYPE in agf agi agfl sb; do + DADDR=`$XFS_DB_PROG -c "$TYPE" -c "daddr" $SCRATCH_DEV | _filter_dbval` + $XFS_DB_PROG -c "$TYPE" -c "daddr 42" -c "daddr $DADDR" -c "type $TYPE" $SCRATCH_DEVHm is there a reason for the first "-c $TYPE" or even the "daddr 42" in the line just above?
It's drawn from the reproducer test case.
The first "-c $TYPE" sets the object, "daddr 42" is an arbitrary address set. Without the daddr change and change-back, the test will pass even without the recentxfs_dbxfsprogs change.Quoted 6 lines
Quoted 4 lines
Really? Not here, xfsprogs-4.5.0 :
# xfs_db -c "daddr 2" -c "type agi" fsfile Metadata CRC error detected at xfs_agi block 0x2/0x200Ahh, ok, you're correct - I'll modify the test accordingly.
Wait. I still think the object has to get set with "-c $TYPE". If not the crc error occurs even with the new
xfs_dbcode:
Quoted 9 lines
# xfs_db -V xfs_db version 4.12.0-rc2 # xfs_db /dev/sda6 xfs_db> daddr current daddr is 0 xfs_db> daddr 2 xfs_db> type agi Metadata CRC error detected at xfs_agi block 0x2/0x1000 Metadata CRC error detected at xfs_agi block 0x2/0x1000
You've set daddr to 2... presumably on a 4k sector fs ...
Quoted 7 lines
And error is gone when the object is set and the daddr gets set to the correct value.
[root@localhost xfsprogs-dev3]#xfs_db/dev/sda6xfs_db> agixfs_db> daddr
current daddr is 16
... but the agi is at daddr 16, not 2.
IOWS, you've told it the wrong type for daddr 2 (which is halfway through the first superblock; daddr 2 is not the beginning of any on-disk structure) so if you ask it to tell you about that block as an
AGI, it'll tell you that it's corrupted, because it's /not/ an agi.
Quoted 2 lines
xfs_db> daddr 2xfs_db> daddr 16
If you correctly tell it to show you block 16 as an AGI...
Quoted 1 line
xfs_db> type agi
... it works.
-Eric
Re: [PATCH] xfs/424: test xfs_db to ensure type size taken into account with new type
In reply to Eric SandeenQuoted 83 lines · Eric Sandeen
Quoted 67 lines · Bill O'Donnell
xfs_dbshould take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error.Signed-off-by Bill O'Donnell <[email protected]>---
v2: Clarify commit message and test comments. Add a few more test cases.tests/xfs/424 | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 1 + tests/xfs/group | 1 + 3 files changed, 79 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.outtests/xfs/424 new file +45
-0@@ -0,0 +1,77 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +_filter_dbval() +{ + awk '{ print $4 }' +}tests/xfs/424 line 55
Quoted 10 lines
tests/xfs/424 new file +10
-0+ +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux
_supported_fsxfs
Quoted 12 lines
tests/xfs/424 line 65
Quoted 10 lines
tests/xfs/424 new file +10
-0+_require_scratch + +# real QA test starts here +_scratch_unmount >> $seqres.full 2>&1 + +# for different sector sizes, ensure no CRC errors are falsely reported + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt.This leaves me wondering why we don't test most of the above ;)
Same here.
Quoted 9 lines
tests/xfs/424 line 71
Quoted 6 lines
tests/xfs/424 new file +6
-0+# For various sector sizes, test some types that involve type size. +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + for TYPE in agf agi agfl sb; do + DADDR=`$XFS_DB_PROG -c "$TYPE" -c "daddr" $SCRATCH_DEV | _filter_dbval` + $XFS_DB_PROG -c "$TYPE" -c "daddr 42" -c "daddr $DADDR" -c "type $TYPE" $SCRATCH_DEVHm is there a reason for the first "-c $TYPE" or even the "daddr 42" in the line just above?
Quoted 7 lines
Interesting, I didn't know that a bare "agf" works, but it does (and is documented as such). fair enough.
It'd be very easy to add just a few more types to this, i.e.: (leaving the extra
type & daddr setting in place for now)DADDR=
$XFS_DB_PROG -c "sb" -c "addr rootino" -c "daddr" $SCRATCH_DEV | _filter_dbval
/me wonders if this ought to be wrapped up into a helper ala _scratch_xfs_get_metadata_field in common/fuzzy?
Quoted 1 line
$XFS_DB_PROG -c "type inode" -c "daddr 42" -c "daddr $DADDR" -c "type inode" $SCRATCH_DEV
_scratch_xfs_db, not $XFS_DB_PROG...$SCRATCH_DEV, or else this won't work with fses with external logs.
Quoted 6 lines
DADDR=
$XFS_DB_PROG -c "agf" -c "addr bnoroot" -c "daddr" $SCRATCH_DEV | _filter_dbval$XFS_DB_PROG -c "type bnobt" -c "daddr 42" -c "daddr $DADDR" -c "type bnobt" $SCRATCH_DEVDADDR=
$XFS_DB_PROG -c "agf" -c "addr cntroot" -c "daddr" $SCRATCH_DEV | _filter_dbval$XFS_DB_PROG -c "type cntbt" -c "daddr 42" -c "daddr $DADDR" -c "type cntbt" $SCRATCH_DEV
Quoted 7 lines
DADDR=
$XFS_DB_PROG -c "agi" -c "addr root" -c "daddr" $SCRATCH_DEV | _filter_dbval$XFS_DB_PROG -c "type inobt" -c "daddr 42" -c "daddr $DADDR" -c "type inobt" $SCRATCH_DEVDADDR=
$XFS_DB_PROG -c "agi" -c "addr free_root" -c "daddr" $SCRATCH_DEV | _filter_dbval$XFS_DB_PROG -c "type finobt" -c "daddr 42" -c "daddr $DADDR" -c "type finobt" $SCRATCH_DEVothers such as attr, dir, symlink would require more filesystem preparation I guess.
_scratch_populate_cached?
--D
Quoted 31 lines
Thanks,
-EricQuoted 19 lines
tests/xfs/424 new file +6
-0+ done +done + +# success, all done +status=0 +exittests/xfs/424.out new file +1
-0@@ -0,0 +1 @@ +QA output created by 424tests/xfs/group +0
-0tests/xfs/group line 424
Quoted 4 lines
tests/xfs/group +1
-0@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick db--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 1/1 xfs/424: test xfs_db to ensure type size taken into account with new type
In reply to Bill O'Donnellxfs_db should take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error.
---
v2: Clarify commit message and test comments. Add a few more test cases.
v3: Add more test cases. Use _scratch_xfs_db instead of $XFS_DB_PROG to
accomodate fses with external logs. Remove superfluous daddr and type commands.
tests/xfs/424 | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 1 + tests/xfs/group | 1 + 3 files changed, 95 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.out
tests/xfs/424 new file +93 -0
@@ -0,0 +1,93 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +_filter_dbval() +{ + awk '{ print $4 }' +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux +_supported_fs xfs +_require_scratch + +# real QA test starts here +_scratch_unmount >> $seqres.full 2>&1 + +# for different sector sizes, ensure no CRC errors are falsely reported. + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt. +# For various sector sizes, test some types that involve type size. +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + + for TYPE in agf agi agfl sb; do + DADDR=`_scratch_xfs_db -c "$TYPE" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + done + + for TYPE in inodata data log text rtbitmap rtsummary; do + DADDR=`_scratch_xfs_db -c "sb" -c "addr rootino" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + done + + DADDR=`_scratch_xfs_db -c "agf" -c "addr bnoroot" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type bnobt" + DADDR=`_scratch_xfs_db -c "agf" -c "addr cntroot" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type cntbt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr root" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inobt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr free_root" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type finobt" +done + +# success, all done +status=0 +exit
tests/xfs/424.out new file +1 -0
@@ -0,0 +1 @@ +QA output created by 424
tests/xfs/group +1 -0
@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick db
Signature · 1 line
2.13.3
Re: [PATCH v3] xfs/424: test xfs_db to ensure type size taken into account with new type
Quoted 94 lines · Bill O'Donnell
xfs_dbshould take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error.Signed-off-by Bill O'Donnell <[email protected]>---
v2: Clarify commit message and test comments. Add a few more test cases.
v3: Add more test cases. Use_scratch_xfs_dbinstead of $XFS_DB_PROG to
accomodate fses with external logs. Remove superfluous daddr and type commands.tests/xfs/424 | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 1 + tests/xfs/group | 1 + 3 files changed, 95 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.outtests/xfs/424 new file +69
-0@@ -0,0 +1,93 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +_filter_dbval() +{ + awk '{ print $4 }' +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux +_supported_fs xfs +_require_scratch + +# real QA test starts here +_scratch_unmount >> $seqres.full 2>&1 + +# for different sector sizes, ensure no CRC errors are falsely reported. + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt. +# For various sector sizes, test some types that involve type size. +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null
tests/xfs/424 line 79
Quoted 10 lines
tests/xfs/424 new file +10
-0+ + for TYPE in agf agi agfl sb; do + DADDR=`_scratch_xfs_db -c "$TYPE" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + done + + for TYPE in inodata data log text rtbitmap rtsummary; do + DADDR=`_scratch_xfs_db -c "sb" -c "addr rootino" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + done
Ok, I don't understand this part. For each of those types, you get the address of the root inode, then set it to the type - including types which are... not inodes?
(sure, type text & type data can be anything, but the others are specific data types...)
tests/xfs/424 line 88
Quoted 9 lines
tests/xfs/424 new file +9
-0+ + DADDR=`_scratch_xfs_db -c "agf" -c "addr bnoroot" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type bnobt" + DADDR=`_scratch_xfs_db -c "agf" -c "addr cntroot" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type cntbt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr root" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inobt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr free_root" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type finobt"
to test the generic data & text types, you could just do:
+ _scratch_xfs_db -c "daddr $DADDR" -c "type text"
+ _scratch_xfs_db -c "daddr $DADDR" -c "type data"
here. They don't hae CRCs anyway so if the test is truly to "test for crc errors" then maybe it's not needed, but it can't hurt to actually iterate through each type that's possible.
Quoted 22 lines
tests/xfs/424 new file +5
-0+done + +# success, all done +status=0 +exittests/xfs/424.out new file +1
-0@@ -0,0 +1 @@ +QA output created by 424tests/xfs/group +1
-0@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick db
Re: [PATCH v3] xfs/424: test xfs_db to ensure type size taken into account with new type
Quoted 102 lines · Eric Sandeen
Quoted 99 lines · Bill O'Donnell
xfs_dbshould take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error.Signed-off-by Bill O'Donnell <[email protected]>---
v2: Clarify commit message and test comments. Add a few more test cases.
v3: Add more test cases. Use_scratch_xfs_dbinstead of $XFS_DB_PROG to
accomodate fses with external logs. Remove superfluous daddr and type commands.tests/xfs/424 | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 1 + tests/xfs/group | 1 + 3 files changed, 95 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.outtests/xfs/424 new file +74
-0@@ -0,0 +1,93 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +_filter_dbval() +{ + awk '{ print $4 }' +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux +_supported_fs xfs +_require_scratch + +# real QA test starts here +_scratch_unmount >> $seqres.full 2>&1 + +# for different sector sizes, ensure no CRC errors are falsely reported. + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt. +# For various sector sizes, test some types that involve type size. +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + + for TYPE in agf agi agfl sb; do + DADDR=`_scratch_xfs_db -c "$TYPE" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + done
Quoted 8 lines
tests/xfs/424 line 79
Quoted 5 lines
tests/xfs/424 new file +5
-0+ + for TYPE in inodata data log text rtbitmap rtsummary; do + DADDR=`_scratch_xfs_db -c "sb" -c "addr rootino" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + doneOk, I don't understand this part. For each of those types, you get the address of the root inode, then set it to the type - including types which are... not inodes?
For this case, where addr set to rootino, the types included indeed work fine, but "type inode" yields crc error(s). :/
It might make more sense to just leave the inodata data log text rtbitmap rtsummary types out of the test.
fs_db> sbxfs_db> addr rootinoxfs_db> daddr
current daddr is 96xfs_db> type inode
Metadata corruption detected at xfs_inode block 0x60/0x200 Metadata corruption detected at xfs_inode block 0x60/0x200 . . .
Quoted 45 lines
(sure, type text & type data can be anything, but the others are specific data types...)
tests/xfs/424 line 88
Quoted 9 lines
tests/xfs/424 new file +9
-0+ + DADDR=`_scratch_xfs_db -c "agf" -c "addr bnoroot" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type bnobt" + DADDR=`_scratch_xfs_db -c "agf" -c "addr cntroot" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type cntbt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr root" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inobt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr free_root" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type finobt"to test the generic data & text types, you could just do:
(quoted diff) +2
-0+ _scratch_xfs_db -c "daddr $DADDR" -c "type text" + _scratch_xfs_db -c "daddr $DADDR" -c "type data"here. They don't hae CRCs anyway so if the test is truly to "test for crc errors" then maybe it's not needed, but it can't hurt to actually iterate through each type that's possible.
Quoted 22 lines
tests/xfs/424 new file +5
-0+done + +# success, all done +status=0 +exittests/xfs/424.out new file +1
-0@@ -0,0 +1 @@ +QA output created by 424tests/xfs/group +1
-0@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick db
Re: [PATCH v3] xfs/424: test xfs_db to ensure type size taken into account with new type
Quoted 112 lines · Bill O'Donnell
Quoted 102 lines · Eric Sandeen
Quoted 99 lines · Bill O'Donnell
xfs_dbshould take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error.Signed-off-by Bill O'Donnell <[email protected]>---
v2: Clarify commit message and test comments. Add a few more test cases.
v3: Add more test cases. Use_scratch_xfs_dbinstead of $XFS_DB_PROG to
accomodate fses with external logs. Remove superfluous daddr and type commands.tests/xfs/424 | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 1 + tests/xfs/group | 1 + 3 files changed, 95 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.outtests/xfs/424 new file +74
-0@@ -0,0 +1,93 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +_filter_dbval() +{ + awk '{ print $4 }' +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux +_supported_fs xfs +_require_scratch + +# real QA test starts here +_scratch_unmount >> $seqres.full 2>&1 + +# for different sector sizes, ensure no CRC errors are falsely reported. + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt. +# For various sector sizes, test some types that involve type size. +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + + for TYPE in agf agi agfl sb; do + DADDR=`_scratch_xfs_db -c "$TYPE" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + doneQuoted 8 lines
tests/xfs/424 line 79
Quoted 5 lines
tests/xfs/424 new file +5
-0+ + for TYPE in inodata data log text rtbitmap rtsummary; do + DADDR=`_scratch_xfs_db -c "sb" -c "addr rootino" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + doneOk, I don't understand this part. For each of those types, you get the address of the root inode, then set it to the type - including types which are... not inodes?
Quoted 2 lines
For this case, where addr set to rootino, the types included indeed work fine, but "type inode" yields crc error(s). :/
My [PATCH] xfs_db: properly set inode type should fix that... but I got hung up on what to do if the current disk address isn't even an inode-aligned sector.
I ... think we should let it proceed, it's a debug tool after all.
Sorry, I forgot this wasn't in.
Quoted 2 lines
It might make more sense to just leave the inodata data log text rtbitmap rtsummary types out of the test.
Or just set them up properly:
+ DADDR=_scratch_xfs_db -c "sb" -c "addr rbmino" -c "daddr" | _filter_dbval
+ _scratch_xfs_db -c "daddr $DADDR" -c "type rtbitmap"
+ DADDR=_scratch_xfs_db -c "sb" -c "addr rsumino" -c "daddr" | _filter_dbval
+ _scratch_xfs_db -c "daddr $DADDR" -c "type rtsummary"
+ DADDR=_scratch_xfs_db -c "sb" -c "addr logstart" -c "daddr" | _filter_dbval
+ _scratch_xfs_db -c "daddr $DADDR" -c "type log"
but i'm a little confused by some of these types. if you go to the sb and then to logstart, xfs_db does indeed set the 'log' type. but if you go to rbmino, it does /not/ set rtbitmap. Given that I don't know what these types are for, I guess it might be best to leave them out of the test for now.
testing inode would be good though - i'll try to get that patch to a point where I can merge it for 4.12, yet.
(and types data & text are trivial enough to do - not much to go wrong there, but may as well exercise them while we're at it)
Might be worth it to add a comment about which ones don't get tested at this point.
-Eric
Quoted 58 lines
fs_db> sbxfs_db> addr rootinoxfs_db> daddr
current daddr is 96xfs_db> type inode
Metadata corruption detected atxfs_inodeblock 0x60/0x200 Metadata corruption detected atxfs_inodeblock 0x60/0x200Quoted 45 lines
(sure, type text & type data can be anything, but the others are specific data types...)
tests/xfs/424 line 88
Quoted 9 lines
tests/xfs/424 new file +9
-0+ + DADDR=`_scratch_xfs_db -c "agf" -c "addr bnoroot" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type bnobt" + DADDR=`_scratch_xfs_db -c "agf" -c "addr cntroot" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type cntbt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr root" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inobt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr free_root" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type finobt"to test the generic data & text types, you could just do:
(quoted diff) +2
-0+ _scratch_xfs_db -c "daddr $DADDR" -c "type text" + _scratch_xfs_db -c "daddr $DADDR" -c "type data"here. They don't hae CRCs anyway so if the test is truly to "test for crc errors" then maybe it's not needed, but it can't hurt to actually iterate through each type that's possible.
Quoted 22 lines
tests/xfs/424 new file +5
-0+done + +# success, all done +status=0 +exittests/xfs/424.out new file +1
-0@@ -0,0 +1 @@ +QA output created by 424tests/xfs/group +1
-0@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick db
PATCH v4 1/1 xfs/424: test xfs_db to ensure type size taken into account with new type
In reply to Bill O'Donnellxfs_db should take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error.
---
v2: Clarify commit message and test comments. Add a few more test cases.
v3: Add more test cases. Use _scratch_xfs_db instead of $XFS_DB_PROG to
accomodate fses with external logs. Remove superfluous daddr and type commands.
v4: Skip select tests and make a corresponding note in the comments. Add
test for type inode (note: depends on pending xfsprogs patch
xfs_db: properly set inode type).
tests/xfs/424 | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 1 + tests/xfs/group | 1 + 3 files changed, 99 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.out
tests/xfs/424 new file +97 -0
@@ -0,0 +1,97 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +_filter_dbval() +{ + awk '{ print $4 }' +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux +_supported_fs xfs +_require_scratch + +# real QA test starts here +_scratch_unmount >> $seqres.full 2>&1 + +# for different sector sizes, ensure no CRC errors are falsely reported. + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt. +# For various sector sizes, test some types that involve type size. +# +# NOTE: skip attr3, bmapbta, bmapbtd, dir3, dqblk, inodata, symlink +# rtbitmap, rtsummary, log +# +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + + for TYPE in agf agi agfl sb; do + DADDR=`_scratch_xfs_db -c "$TYPE" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + done + + DADDR=`_scratch_xfs_db -c "sb" -c "addr rootino" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inode" + DADDR=`_scratch_xfs_db -c "agf" -c "addr bnoroot" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type bnobt" + DADDR=`_scratch_xfs_db -c "agf" -c "addr cntroot" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type cntbt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr root" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inobt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr free_root" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type finobt" + + _scratch_xfs_db -c "daddr $DADDR" -c "type text" + _scratch_xfs_db -c "daddr $DADDR" -c "type data" +done + +# success, all done +status=0 +exit
tests/xfs/424.out new file +1 -0
@@ -0,0 +1 @@ +QA output created by 424
tests/xfs/group +1 -0
@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick db
Signature · 1 line
2.13.3
Re: [PATCH v4] xfs/424: test xfs_db to ensure type size taken into account with new type
Quoted 6 lines · Bill O'Donnell
xfs_dbshould take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error.Signed-off-by Bill O'Donnell <[email protected]>
Quoted 8 lines
---
v2: Clarify commit message and test comments. Add a few more test cases.
v3: Add more test cases. Use_scratch_xfs_dbinstead of $XFS_DB_PROG to
accomodate fses with external logs. Remove superfluous daddr and type commands.
v4: Skip select tests and make a corresponding note in the comments. Add
test for type inode (note: depends on pending xfsprogs patch
xfs_db: properly set inode type).
Eric, Darrick, do you have any more comments on this test? Thanks a lot for your reviews on previous versions!
I have some nitpicks from the fstests point of view, though :)
Quoted 46 lines
tests/xfs/424 | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 1 + tests/xfs/group | 1 + 3 files changed, 99 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.outtests/xfs/424 new file +32
-0@@ -0,0 +1,97 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$
tests/xfs/424 line 42
Quoted 10 lines
tests/xfs/424 new file +10
-0+status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +_filter_dbval()
I'd name it without the leading underscore, as it's a local function.
Quoted 8 lines
tests/xfs/424 new file +8
-0+{ + awk '{ print $4 }' +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +
tests/xfs/424 line 60
Quoted 10 lines
tests/xfs/424 new file +10
-0+# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux +_supported_fs xfs +_require_scratch + +# real QA test starts here +_scratch_unmount >> $seqres.full 2>&1
This is not needed, _require_scratch will umount and _fail if umount failed.
Quoted 22 lines
tests/xfs/424 new file +22
-0+ +# for different sector sizes, ensure no CRC errors are falsely reported. + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt. +# For various sector sizes, test some types that involve type size. +# +# NOTE: skip attr3, bmapbta, bmapbtd, dir3, dqblk, inodata, symlink +# rtbitmap, rtsummary, log +# +for SECTOR_SIZE in 512 1024 2048 4096; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + + for TYPE in agf agi agfl sb; do + DADDR=`_scratch_xfs_db -c "$TYPE" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + done + + DADDR=`_scratch_xfs_db -c "sb" -c "addr rootino" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inode" + DADDR=`_scratch_xfs_db -c "agf" -c "addr bnoroot" -c "daddr" | _filter_dbval`
tests/xfs/424 line 92
Quoted 10 lines
tests/xfs/424 new file +10
-0+ _scratch_xfs_db -c "daddr $DADDR" -c "type bnobt" + DADDR=`_scratch_xfs_db -c "agf" -c "addr cntroot" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type cntbt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr root" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inobt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr free_root" -c "daddr" | _filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type finobt" + + _scratch_xfs_db -c "daddr $DADDR" -c "type text" + _scratch_xfs_db -c "daddr $DADDR" -c "type data"
Please use tab for indention.
tests/xfs/424 line 93
Quoted 1 line
tests/xfs/424 new file +1
-0+done
And need to echo "Silence is golden" somewhere in the test to indicate we don't expect any output from the test.
Thanks,
Eryu
Quoted 27 lines
tests/xfs/424 new file +4
-0+ +# success, all done +status=0 +exittests/xfs/424.out new file +1
-0@@ -0,0 +1 @@ +QA output created by 424tests/xfs/group +1
-0@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick dbSignature · 6 lines
2.13.3 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v5 1/1 xfs/424: test xfs_db to ensure type size taken into account with new type
In reply to Bill O'Donnellxfs_db should take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error.
---
v2: Clarify commit message and test comments. Add a few more test cases.
v3: Add more test cases. Use _scratch_xfs_db instead of $XFS_DB_PROG to
accomodate fses with external logs. Remove superfluous daddr and type commands.
v4: Skip select tests and make a corresponding note in the comments. Add
test for type inode (note: depends on pending xfsprogs patch
xfs_db: properly set inode type).
v5: Cleanup tabs/spaces and whitespace. Rename local function filter_dbval().
Remove unneeded _scratch_unmount. Add "Silence is golden" output.
tests/xfs/424 | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 2 ++ tests/xfs/group | 1 + 3 files changed, 106 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.out
tests/xfs/424 new file +103 -0
@@ -0,0 +1,103 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +filter_dbval() +{ + awk '{ print $4 }' +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux +_supported_fs xfs +_require_scratch + +echo "Silence is golden." + +# real QA test starts here + +# for different sector sizes, ensure no CRC errors are falsely reported. + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt. +# For various sector sizes, test some types that involve type size. +# +# NOTE: skip attr3, bmapbta, bmapbtd, dir3, dqblk, inodata, symlink +# rtbitmap, rtsummary, log +# +for SECTOR_SIZE in 512 1024 2048 4096; do +$MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + + for TYPE in agf agi agfl sb; do + DADDR=`_scratch_xfs_db -c "$TYPE" -c "daddr" | filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + done + + DADDR=`_scratch_xfs_db -c "sb" -c "addr rootino" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inode" + DADDR=`_scratch_xfs_db -c "agf" -c "addr bnoroot" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type bnobt" + DADDR=`_scratch_xfs_db -c "agf" -c "addr cntroot" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type cntbt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr root" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inobt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr free_root" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type finobt" + + _scratch_xfs_db -c "daddr $DADDR" -c "type text" + _scratch_xfs_db -c "daddr $DADDR" -c "type data" +done + +# success, all done +status=0 +exit
tests/xfs/424.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 424 +Silence is golden.
tests/xfs/group +1 -0
@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick db
Signature · 1 line
2.13.3
Re: [PATCH v5] xfs/424: test xfs_db to ensure type size taken into account with new type
Quoted 93 lines · Bill O'Donnell
xfs_dbshould take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error.Signed-off-by Bill O'Donnell <[email protected]>---
v2: Clarify commit message and test comments. Add a few more test cases.
v3: Add more test cases. Use_scratch_xfs_dbinstead of $XFS_DB_PROG to
accomodate fses with external logs. Remove superfluous daddr and type commands.
v4: Skip select tests and make a corresponding note in the comments. Add
test for type inode (note: depends on pending xfsprogs patch
xfs_db: properly set inode type).
v5: Cleanup tabs/spaces and whitespace. Rename local functionfilter_dbval().
Remove unneeded_scratch_unmount. Add "Silence is golden" output.tests/xfs/424 | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 2 ++ tests/xfs/group | 1 + 3 files changed, 106 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.outtests/xfs/424 new file +63
-0@@ -0,0 +1,103 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +filter_dbval() +{ + awk '{ print $4 }' +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux +_supported_fs xfs +_require_scratch + +echo "Silence is golden." + +# real QA test starts here + +# for different sector sizes, ensure no CRC errors are falsely reported.
tests/xfs/424 line 73
Quoted 10 lines
tests/xfs/424 new file +10
-0+ +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt. +# For various sector sizes, test some types that involve type size. +# +# NOTE: skip attr3, bmapbta, bmapbtd, dir3, dqblk, inodata, symlink +# rtbitmap, rtsummary, log +# +for SECTOR_SIZE in 512 1024 2048 4096; do
Sorry, I just found this today, this may not work with 4k sector disks. Seems we need to work out the supported sector sizes from _min_dio_alignment $SCRATCH_DEV, e.g.
sec_sz=_min_dio_alignment $SCRATCH_DEV
while [ $sec_sz -le 4096 ]; do
sector_sizes="$sector_sizes $sec_sz" sec_sz=$((sec_sz * 2))
done
for SECTOR_SIZE in $sector_sizes; do
...
tests/xfs/424 line 74
Quoted 1 line
tests/xfs/424 new file +1
-0+$MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null
And the indention of this MKFS_XFS_PROG seems wrong :)
Thanks,
Eryu
Quoted 53 lines
tests/xfs/424 new file +29
-0+ + for TYPE in agf agi agfl sb; do + DADDR=`_scratch_xfs_db -c "$TYPE" -c "daddr" | filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + done + + DADDR=`_scratch_xfs_db -c "sb" -c "addr rootino" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inode" + DADDR=`_scratch_xfs_db -c "agf" -c "addr bnoroot" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type bnobt" + DADDR=`_scratch_xfs_db -c "agf" -c "addr cntroot" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type cntbt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr root" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inobt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr free_root" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type finobt" + + _scratch_xfs_db -c "daddr $DADDR" -c "type text" + _scratch_xfs_db -c "daddr $DADDR" -c "type data" +done + +# success, all done +status=0 +exittests/xfs/424.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 424 +Silence is golden.tests/xfs/group +1
-0@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick dbSignature · 6 lines
2.13.3 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5] xfs/424: test xfs_db to ensure type size taken into account with new type
Quoted 113 lines · Eryu Guan
Quoted 93 lines · Bill O'Donnell
xfs_dbshould take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error.Signed-off-by Bill O'Donnell <[email protected]>---
v2: Clarify commit message and test comments. Add a few more test cases.
v3: Add more test cases. Use_scratch_xfs_dbinstead of $XFS_DB_PROG to
accomodate fses with external logs. Remove superfluous daddr and type commands.
v4: Skip select tests and make a corresponding note in the comments. Add
test for type inode (note: depends on pending xfsprogs patch
xfs_db: properly set inode type).
v5: Cleanup tabs/spaces and whitespace. Rename local functionfilter_dbval().
Remove unneeded_scratch_unmount. Add "Silence is golden" output.tests/xfs/424 | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 2 ++ tests/xfs/group | 1 + 3 files changed, 106 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.outtests/xfs/424 new file +63
-0@@ -0,0 +1,103 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +filter_dbval() +{ + awk '{ print $4 }' +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux +_supported_fs xfs +_require_scratch + +echo "Silence is golden." + +# real QA test starts here + +# for different sector sizes, ensure no CRC errors are falsely reported.tests/xfs/424 line 73
Quoted 10 lines
tests/xfs/424 new file +10
-0+ +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt. +# For various sector sizes, test some types that involve type size. +# +# NOTE: skip attr3, bmapbta, bmapbtd, dir3, dqblk, inodata, symlink +# rtbitmap, rtsummary, log +# +for SECTOR_SIZE in 512 1024 2048 4096; doSorry, I just found this today, this may not work with 4k sector disks. Seems we need to work out the supported sector sizes from
_min_dio_alignment $SCRATCH_DEV, e.g.sec_sz=
_min_dio_alignment $SCRATCH_DEV
while [ $sec_sz -le 4096 ]; dosector_sizes="$sector_sizes $sec_sz" sec_sz=$((sec_sz * 2))
Quoted 8 lines
done
for
SECTOR_SIZEin $sector_sizes; do
...tests/xfs/424 line 74
Quoted 1 line
tests/xfs/424 new file +1
-0+$MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/nullAnd the indention of this
MKFS_XFS_PROGseems wrong :)
Ahh! Good catch, and thank you. I'll submit a v6.
-Bill
Quoted 57 lines
Thanks,
EryuQuoted 53 lines
tests/xfs/424 new file +29
-0+ + for TYPE in agf agi agfl sb; do + DADDR=`_scratch_xfs_db -c "$TYPE" -c "daddr" | filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + done + + DADDR=`_scratch_xfs_db -c "sb" -c "addr rootino" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inode" + DADDR=`_scratch_xfs_db -c "agf" -c "addr bnoroot" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type bnobt" + DADDR=`_scratch_xfs_db -c "agf" -c "addr cntroot" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type cntbt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr root" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inobt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr free_root" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type finobt" + + _scratch_xfs_db -c "daddr $DADDR" -c "type text" + _scratch_xfs_db -c "daddr $DADDR" -c "type data" +done + +# success, all done +status=0 +exittests/xfs/424.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 424 +Silence is golden.tests/xfs/group +1
-0@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick dbSignature · 6 lines
2.13.3 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v6 1/1 xfs/424: test xfs_db to ensure type size taken into account with new type
In reply to Bill O'Donnellxfs_db should take type size into account when setting type. If type size isn't updated whenever type is set, a false crc error can occur due to the stale size. This test checks for that false crc error.
---
v2: Clarify commit message and test comments. Add a few more test cases.
v3: Add more test cases. Use _scratch_xfs_db instead of $XFS_DB_PROG to
accomodate fses with external logs. Remove superfluous daddr and type commands.
v4: Skip select tests and make a corresponding note in the comments. Add
test for type inode (note: depends on pending xfsprogs patch
xfs_db: properly set inode type).
v5: Cleanup tabs/spaces and whitespace. Rename local function filter_dbval().
Remove unneeded _scratch_unmount. Add "Silence is golden" output.
v6: use supported sector sizes from _min_dio_alignment
tests/xfs/424 | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/424.out | 2 + tests/xfs/group | 1 + 3 files changed, 112 insertions(+) create mode 100755 tests/xfs/424 create mode 100644 tests/xfs/424.out
tests/xfs/424 new file +109 -0
@@ -0,0 +1,109 @@ +#! /bin/bash +# FS QA Test 424 +# +# xfs_db should take type size into account when setting type. +# If type size isn't updated whenever type is set, a false crc +# error can occur due to the stale size. This test checks for +# that false crc error. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +filter_dbval() +{ + awk '{ print $4 }' +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate +_supported_os Linux +_supported_fs xfs +_require_scratch + +echo "Silence is golden." + +# real QA test starts here + +# for different sector sizes, ensure no CRC errors are falsely reported. + +# Supported types include: agf, agfl, agi, attr3, bmapbta, +# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata, +# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt. +# For various sector sizes, test some types that involve type size. +# +# NOTE: skip attr3, bmapbta, bmapbtd, dir3, dqblk, inodata, symlink +# rtbitmap, rtsummary, log +# +sec_sz=`_min_dio_alignment $SCRATCH_DEV` +while [ $sec_sz -le 4096 ]; do + sector_sizes="$sector_sizes $sec_sz" + sec_sz=$((sec_sz * 2)) +done + +for SECTOR_SIZE in $sector_sizes; do + $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV > /dev/null + + for TYPE in agf agi agfl sb; do + DADDR=`_scratch_xfs_db -c "$TYPE" -c "daddr" | filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE" + done + + DADDR=`_scratch_xfs_db -c "sb" -c "addr rootino" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inode" + DADDR=`_scratch_xfs_db -c "agf" -c "addr bnoroot" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type bnobt" + DADDR=`_scratch_xfs_db -c "agf" -c "addr cntroot" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type cntbt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr root" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type inobt" + DADDR=`_scratch_xfs_db -c "agi" -c "addr free_root" -c "daddr" | + filter_dbval` + _scratch_xfs_db -c "daddr $DADDR" -c "type finobt" + + _scratch_xfs_db -c "daddr $DADDR" -c "type text" + _scratch_xfs_db -c "daddr $DADDR" -c "type data" +done + +# success, all done +status=0 +exit
tests/xfs/424.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 424 +Silence is golden.
tests/xfs/group +1 -0
@@ -421,3 +421,4 @@ 421 auto quick clone dedupe 422 dangerous_scrub dangerous_online_repair 423 dangerous_scrub +424 auto quick db
Signature · 1 line
2.13.3