summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2014-07-28 15:37:03 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-07-28 15:37:03 -0400
commitd230dc4a3ead2a5507f1edbf2ac603715c292019 (patch)
tree003bbf9e9ec7bfd6639c6b9881703e5e49094d2b
parent01824c9bbcd2c1037085213f6cd7d591f78db9c5 (diff)
downloade2fsprogs-d230dc4a3ead2a5507f1edbf2ac603715c292019.tar.gz
tests: add the f_badcluster test
This should have been part of commit 9a1d614df21 ("e2fsck: fix rule-violating lblk->pblk mappings on bigalloc filesystems") but it accidentally got dropped when the patch was applied. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--tests/f_badcluster/expect198
-rw-r--r--tests/f_badcluster/image.gzbin0 -> 3149 bytes
-rw-r--r--tests/f_badcluster/name2
-rw-r--r--tests/f_badcluster/script24
4 files changed, 224 insertions, 0 deletions
diff --git a/tests/f_badcluster/expect b/tests/f_badcluster/expect
new file mode 100644
index 00000000..5a60cf33
--- /dev/null
+++ b/tests/f_badcluster/expect
@@ -0,0 +1,198 @@
+Pass 1: Checking inodes, blocks, and sizes
+Inode 12 logical block 2 (physical block 1154) violates cluster allocation rules.
+Will fix in pass 1B.
+Inode 12, i_blocks is 32, should be 64. Fix? yes
+
+Inode 16 logical block 5 (physical block 1173) violates cluster allocation rules.
+Will fix in pass 1B.
+Inode 16, i_size is 3072, should be 6144. Fix? yes
+
+Inode 16, i_blocks is 32, should be 64. Fix? yes
+
+Inode 17 logical block 0 (physical block 1186) violates cluster allocation rules.
+Will fix in pass 1B.
+Inode 17 logical block 2 (physical block 1184) violates cluster allocation rules.
+Will fix in pass 1B.
+Inode 17, i_blocks is 32, should be 64. Fix? yes
+
+Inode 18 logical block 3 (physical block 1201) violates cluster allocation rules.
+Will fix in pass 1B.
+Inode 18, i_blocks is 32, should be 64. Fix? yes
+
+
+Running additional passes to resolve blocks claimed by more than one inode...
+Pass 1B: Rescanning for multiply-claimed blocks
+Multiply-claimed block(s) in inode 12: 1154
+Multiply-claimed block(s) in inode 13: 1152 1153 1154
+Multiply-claimed block(s) in inode 14: 1648 1649 1650
+Multiply-claimed block(s) in inode 15: 1650
+Multiply-claimed block(s) in inode 16: 1173
+Multiply-claimed block(s) in inode 17: 1186 1185 1184
+Multiply-claimed block(s) in inode 18: 1201
+Pass 1C: Scanning directories for inodes with multiply-claimed blocks
+Pass 1D: Reconciling multiply-claimed blocks
+(There are 7 inodes containing multiply-claimed blocks.)
+
+File /a (inode #12, mod time Tue Jun 17 08:00:50 2014)
+ has 1 multiply-claimed block(s), shared with 1 file(s):
+ /b (inode #13, mod time Tue Jun 17 08:00:50 2014)
+Clone multiply-claimed blocks? yes
+
+File /b (inode #13, mod time Tue Jun 17 08:00:50 2014)
+ has 1 multiply-claimed block(s), shared with 1 file(s):
+ /a (inode #12, mod time Tue Jun 17 08:00:50 2014)
+Multiply-claimed blocks already reassigned or cloned.
+
+File /c (inode #14, mod time Tue Jun 17 08:00:50 2014)
+ has 1 multiply-claimed block(s), shared with 1 file(s):
+ /d (inode #15, mod time Tue Jun 17 08:00:50 2014)
+Clone multiply-claimed blocks? yes
+
+File /d (inode #15, mod time Tue Jun 17 08:00:50 2014)
+ has 1 multiply-claimed block(s), shared with 1 file(s):
+ /c (inode #14, mod time Tue Jun 17 08:00:50 2014)
+Multiply-claimed blocks already reassigned or cloned.
+
+File /e (inode #16, mod time Tue Jun 17 08:00:50 2014)
+ has 1 multiply-claimed block(s), shared with 0 file(s):
+Clone multiply-claimed blocks? yes
+
+File /f (inode #17, mod time Tue Jun 17 08:00:50 2014)
+ has 1 multiply-claimed block(s), shared with 0 file(s):
+Clone multiply-claimed blocks? yes
+
+File /g (inode #18, mod time Tue Jun 17 08:00:50 2014)
+ has 1 multiply-claimed block(s), shared with 0 file(s):
+Clone multiply-claimed blocks? yes
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Free blocks count wrong for group #0 (50, counted=47).
+Fix? yes
+
+Free blocks count wrong (800, counted=752).
+Fix? yes
+
+
+test_fs: ***** FILE SYSTEM WAS MODIFIED *****
+test_fs: 18/128 files (22.2% non-contiguous), 1296/2048 blocks
+Pass 1: Checking inodes, blocks, and sizes
+Inode 12, i_blocks is 64, should be 32. Fix? yes
+
+Inode 16, i_blocks is 64, should be 32. Fix? yes
+
+Inode 17, i_blocks is 64, should be 32. Fix? yes
+
+Inode 18, i_blocks is 64, should be 32. Fix? yes
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Block bitmap differences: -(1168--1200)
+Fix? yes
+
+Free blocks count wrong for group #0 (47, counted=50).
+Fix? yes
+
+Free blocks count wrong (752, counted=800).
+Fix? yes
+
+
+test_fs: ***** FILE SYSTEM WAS MODIFIED *****
+test_fs: 18/128 files (5.6% non-contiguous), 1248/2048 blocks
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_fs: 18/128 files (5.6% non-contiguous), 1248/2048 blocks
+debugfs: stat /a
+Inode: 12 Type: regular Mode: 0644 Flags: 0x80000
+Generation: 1117152157 Version: 0x00000001
+User: 0 Group: 0 Size: 3072
+File ACL: 0 Directory ACL: 0
+Links: 1 Blockcount: 32
+Fragment: Address: 0 Number: 0 Size: 0
+ctime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+atime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+mtime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+EXTENTS:
+(0-1):1136-1137, (2):1138
+debugfs: stat /b
+Inode: 13 Type: regular Mode: 0644 Flags: 0x80000
+Generation: 1117152158 Version: 0x00000001
+User: 0 Group: 0 Size: 3072
+File ACL: 0 Directory ACL: 0
+Links: 1 Blockcount: 32
+Fragment: Address: 0 Number: 0 Size: 0
+ctime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+atime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+mtime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+EXTENTS:
+(0-2):1152-1154
+debugfs: stat /c
+Inode: 14 Type: regular Mode: 0644 Flags: 0x80000
+Generation: 1117152159 Version: 0x00000001
+User: 0 Group: 0 Size: 3072
+File ACL: 0 Directory ACL: 0
+Links: 1 Blockcount: 32
+Fragment: Address: 0 Number: 0 Size: 0
+ctime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+atime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+mtime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+EXTENTS:
+(0-1):1216-1217, (2):1218
+debugfs: stat /d
+Inode: 15 Type: regular Mode: 0644 Flags: 0x0
+Generation: 1117152160 Version: 0x00000001
+User: 0 Group: 0 Size: 3072
+File ACL: 0 Directory ACL: 0
+Links: 1 Blockcount: 32
+Fragment: Address: 0 Number: 0 Size: 0
+ctime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+atime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+mtime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+BLOCKS:
+(TIND):1650
+TOTAL: 1
+
+debugfs: stat /e
+Inode: 16 Type: regular Mode: 0644 Flags: 0x80000
+Generation: 1117152161 Version: 0x00000001
+User: 0 Group: 0 Size: 6144
+File ACL: 0 Directory ACL: 0
+Links: 1 Blockcount: 32
+Fragment: Address: 0 Number: 0 Size: 0
+ctime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+atime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+mtime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+EXTENTS:
+(0-2):1664-1666, (5):1669
+debugfs: stat /f
+Inode: 17 Type: regular Mode: 0644 Flags: 0x80000
+Generation: 1117152162 Version: 0x00000001
+User: 0 Group: 0 Size: 3072
+File ACL: 0 Directory ACL: 0
+Links: 1 Blockcount: 32
+Fragment: Address: 0 Number: 0 Size: 0
+ctime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+atime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+mtime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+EXTENTS:
+(0):1232, (1):1233, (2):1234
+debugfs: stat /g
+Inode: 18 Type: regular Mode: 0644 Flags: 0x80000
+Generation: 1117152163 Version: 0x00000001
+User: 0 Group: 0 Size: 3072
+File ACL: 0 Directory ACL: 0
+Links: 1 Blockcount: 32
+Fragment: Address: 0 Number: 0 Size: 0
+ctime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+atime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+mtime: 0x539ff5b2 -- Tue Jun 17 08:00:50 2014
+EXTENTS:
+(0-2):1680-1682, (3):1683
+debugfs: \ No newline at end of file
diff --git a/tests/f_badcluster/image.gz b/tests/f_badcluster/image.gz
new file mode 100644
index 00000000..3f21e98e
--- /dev/null
+++ b/tests/f_badcluster/image.gz
Binary files differ
diff --git a/tests/f_badcluster/name b/tests/f_badcluster/name
new file mode 100644
index 00000000..266f81c9
--- /dev/null
+++ b/tests/f_badcluster/name
@@ -0,0 +1,2 @@
+test alignment problems with bigalloc clusters
+
diff --git a/tests/f_badcluster/script b/tests/f_badcluster/script
new file mode 100644
index 00000000..74498a44
--- /dev/null
+++ b/tests/f_badcluster/script
@@ -0,0 +1,24 @@
+if test -x $DEBUGFS_EXE; then
+ IMAGE=$test_dir/../f_badcluster/image.gz
+ OUT=$test_name.log
+ EXP=$test_dir/expect
+ gzip -d < $IMAGE > $TMPFILE
+ $FSCK -fy $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed > $OUT
+ $FSCK -fy $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
+ $FSCK -fy $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
+ for i in a b c d e f g; do echo "stat /$i"; done | $DEBUGFS_EXE $TMPFILE >> $OUT
+
+ cmp -s $OUT $EXP
+ status=$?
+
+ if [ "$status" = 0 ]; then
+ echo "$test_name: $test_description: ok"
+ touch $test_name.ok
+ else
+ echo "$test_name: $test_description: failed"
+ diff $DIFF_OPTS $EXP $OUT > $test_name.failed
+ rm -f $test_name.tmp
+ fi
+else
+ echo "$test_name: skipped"
+fi