Review: fix b0rked test 030 behaviour.
Test 030 is not testing things as it should.
Specifically, corrupting the AGFL with "-1" is a no-op on a freshly repaired filesystem, because xfs_repair rebuilds the AGF btrees and AGFL from scratch and does not populate the AGFL.
The current test does:
repair
mount
create file
remove file
umount
And it does the filesystem twiddling to check that the filesystem is ußable after repair. The problem is that this doesn't dirty the filesystem - the create is followed by a remove, so nothing is actually allocated and so the AGFL lists do not get modified.
hence after a repair/check/corruption cycle, writing "-1" to the AGFL is a no-op because it is already full of "-1" fields (NULL blocks).
With filestreams, the create/remove pair *does* modify the filesystem and so when we write "-1" to the AGFL, we get different output because the filesystem detects new corruptions and the test "fails".
So, to make behaviour consistent, dirty the filesystem before corrupting it on each cycle. Hence it doesn't matter if we are using filestreams or not, we'll really test out corrupting the AGFL with NULL blocks (-1) now.
Comments?
Cheers,
Dave.
Signature · 64 lines
Dave Chinner
Principal Engineer
SGI Australian Software Group
---
xfstests/030.out.irix | 4 ++++
xfstests/030.out.linux | 4 ++++
xfstests/common.repair | 10 ++++++++++
3 files changed, 18 insertions(+)
Index: xfs-cmds/xfstests/030.out.irix
===================================================================
--- xfs-cmds.orig/xfstests/030.out.irix 2007-05-03 17:10:29.554803451 +1000
+++ xfs-cmds/xfstests/030.out.irix 2007-05-03 17:10:54.227585189 +1000
@@ -262,6 +262,10 @@ Wrote X.XXKb (value 0xffffffff)
Phase 1 - find and verify superblock...
Phase 2 - zero log...
- scan filesystem freespace and inode maps...
+bad agbno AGBNO in agfl, agno 0
+bad agbno AGBNO in agfl, agno 0
+bad agbno AGBNO in agfl, agno 0
+bad agbno AGBNO in agfl, agno 0
- found root inode chunk
Phase 3 - for each AG...
- scan and clear agi unlinked lists...
Index: xfs-cmds/xfstests/030.out.linux
===================================================================
--- xfs-cmds.orig/xfstests/030.out.linux 2007-05-03 17:10:29.554803451 +1000
+++ xfs-cmds/xfstests/030.out.linux 2007-05-03 17:10:54.231584667 +1000
@@ -270,6 +270,10 @@ Phase 1 - find and verify superblock...
Phase 2 - using <TYPEOF> log
- zero log...
- scan filesystem freespace and inode maps...
+bad agbno AGBNO in agfl, agno 0
+bad agbno AGBNO in agfl, agno 0
+bad agbno AGBNO in agfl, agno 0
+bad agbno AGBNO in agfl, agno 0
- found root inode chunk
Phase 3 - for each AG...
- scan and clear agi unlinked lists...
Index: xfs-cmds/xfstests/common.repair
===================================================================
--- xfs-cmds.orig/xfstests/common.repair 2007-05-03 17:10:29.554803451 +1000
+++ xfs-cmds/xfstests/common.repair 2007-05-03 17:10:54.231584667 +1000
@@ -72,8 +72,18 @@ _check_repair()
{
value=$1
structure="$2"
+
+ #ensure the filesystem has been dirtied since last repair
+ _scratch_mount
+ POSIXLY_CORRECT=yes \
+ dd if=/bin/sh of=$SCRATCH_MNT/sh 2>&1 |_filter_dd
+ sync
+ rm -f $SCRATCH_MNT/sh
+ umount $SCRATCH_MNT
+
_zero_position $value "$structure"
_scratch_xfs_repair 2>&1 | _filter_repair
+
# some basic sanity checks...
_check_scratch_fs
_scratch_mount #mountChange looks good Dave, test 148 (xfs_prepair64 version of 030) will need the same .out file change.
Cheers, David D
xfstests/148.out 2007-05-03 17:10:54.231584667 +1000 renamed from xfstests/148.out 2007-05-03 17:10:29.554803451 +1000 +4 -0
@@ -270,6 +270,10 @@ Phase 1 - find and verify superblock... Phase 2 - using <TYPEOF> log - zero log... - scan filesystem freespace and inode maps... +bad agbno AGBNO in agfl, agno 0 +bad agbno AGBNO in agfl, agno 0 +bad agbno AGBNO in agfl, agno 0 +bad agbno AGBNO in agfl, agno 0 - found root inode chunk Phase 3 - for each AG... - scan and clear agi unlinked lists...
Quoted 104 lines · On Fri, 11 May 2007 11:11:45 +1000 David Chinner <[email protected]> wrote:
Test 030 is not testing things as it should.
Specifically, corrupting the AGFL with "-1" is a no-op on a freshly repaired filesystem, because
xfs_repairrebuilds the AGF btrees and AGFL from scratch and does not populate the AGFL.The current test does:
repair
mount
create file
remove file
umountAnd it does the filesystem twiddling to check that the filesystem is ußable after repair. The problem is that this doesn't dirty the filesystem - the create is followed by a remove, so nothing is actually allocated and so the AGFL lists do not get modified.
hence after a repair/check/corruption cycle, writing "-1" to the AGFL is a no-op because it is already full of "-1" fields (NULL blocks).
With filestreams, the create/remove pair *does* modify the filesystem and so when we write "-1" to the AGFL, we get different output because the filesystem detects new corruptions and the test "fails".
So, to make behaviour consistent, dirty the filesystem before corrupting it on each cycle. Hence it doesn't matter if we are using filestreams or not, we'll really test out corrupting the AGFL with NULL blocks (-1) now.
Comments?
Cheers,
Dave.
Signature · 13 lines
Dave Chinner Principal Engineer SGI Australian Software Group --- xfstests/030.out.irix | 4 ++++ xfstests/030.out.linux | 4 ++++ xfstests/common.repair | 10 ++++++++++ 3 files changed, 18 insertions(+) Index: xfs-cmds/xfstests/030.out.irix ===================================================================xfstests/030.out.irix +4
-0@@ -262,6 +262,10 @@ Wrote X.XXKb (value 0xffffffff) Phase 1 - find and verify superblock... Phase 2 - zero log... - scan filesystem freespace and inode maps... +bad agbno AGBNO in agfl, agno 0 +bad agbno AGBNO in agfl, agno 0 +bad agbno AGBNO in agfl, agno 0 +bad agbno AGBNO in agfl, agno 0 - found root inode chunk Phase 3 - for each AG... - scan and clear agi unlinked lists...Index: xfs-cmds/xfstests/030.out.linux
===================================================================xfstests/030.out.linux +4
-0@@ -270,6 +270,10 @@ Phase 1 - find and verify superblock... Phase 2 - using <TYPEOF> log - zero log... - scan filesystem freespace and inode maps... +bad agbno AGBNO in agfl, agno 0 +bad agbno AGBNO in agfl, agno 0 +bad agbno AGBNO in agfl, agno 0 +bad agbno AGBNO in agfl, agno 0 - found root inode chunk Phase 3 - for each AG... - scan and clear agi unlinked lists...Index: xfs-cmds/xfstests/common.repair
===================================================================xfstests/common.repair +10
-0@@ -72,8 +72,18 @@ _check_repair() { value=$1 structure="$2" + + #ensure the filesystem has been dirtied since last repair + _scratch_mount + POSIXLY_CORRECT=yes \ + dd if=/bin/sh of=$SCRATCH_MNT/sh 2>&1 |_filter_dd + sync + rm -f $SCRATCH_MNT/sh + umount $SCRATCH_MNT + _zero_position $value "$structure" _scratch_xfs_repair 2>&1 | _filter_repair + # some basic sanity checks... _check_scratch_fs _scratch_mount #mount