From d230dc4a3ead2a5507f1edbf2ac603715c292019 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Mon, 28 Jul 2014 15:37:03 -0400 Subject: [PATCH] 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 Signed-off-by: Theodore Ts'o --- tests/f_badcluster/expect | 198 ++++++++++++++++++++++++++++++++++++ tests/f_badcluster/image.gz | Bin 0 -> 3149 bytes tests/f_badcluster/name | 2 + tests/f_badcluster/script | 24 +++++ 4 files changed, 224 insertions(+) create mode 100644 tests/f_badcluster/expect create mode 100644 tests/f_badcluster/image.gz create mode 100644 tests/f_badcluster/name create mode 100644 tests/f_badcluster/script diff --git a/tests/f_badcluster/expect b/tests/f_badcluster/expect new file mode 100644 index 000000000..5a60cf339 --- /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 0000000000000000000000000000000000000000..3f21e98e855bcedc2ade7645eafebe04874f6418 GIT binary patch literal 3149 zc-rmKe>l?#90%~BJ3N$nq`2hA)%AmL9TySbj;oj)t0<4c{0MC*m66%horIh3(=FAB z_Si|`H0Jk@n!DM#F+XBV$tv5f4EwU#m)(AR@BZzc`tSbS>yOVLpFiHu`*}Ve`(hIl zr?vd!hDIr=*rY_%!Za)0@}wQ*$7NJoE#Mf1 z#_+dn24gM2(q(EmY65sgl(kEWW+tZicnf>8?*aI{S+IZN3?cYsY`sTc4Luj6Z0;oT zE&F9*>wXZ@_{(|RcW8#oni$404t$>H%I6uy_-=DRy@$9T{owba>>da)cyFIaVK#Vp z9@|ZGhX&Z#V>~&)4Q{PkuPmK|lY{SOb{CF~*Up4p@5cZ7Y<~Ppn_ZjcRuHdOh~M<= zS;diQ%r6?O0F(z!>u5tqb5s-ak={CUkI#^wq^o1eYC?WS+*UczUgkSV?Obwu{1-T& zq9&@SVb#Tv6|P9lDzrZh6nZmZ&A=2*C%F4O?qX{97+o`#Iw+w<9oOO2q*{CS#qyXt z@J{6vZ~*pHDb(4ef*Dz-*p0uH3|TdKyAW_NM`blEi7tLYZgQy`ldv9->eO{&W7Nmw zfj6U@>YR(Hx^v~*wb*L+-Y$Ac0#Q1{d)inNOnuA53G*+D+$)7;eMtdNT)-m%PkceP z6hpA1Stv^m*qJGZ!qPU*tX>z(8%iw zxCb}7>=~q-Kubj5#dM^(h58742VAM6R{e#S|3qG&gJVPeh3Fb0u~rOj5r_6I%8*@QolkfHc4n{I9KF!vHTUDsa4d!(1o-jGAEU@bOjj}N#4xg68WD|n~lTi zDI+>B;5iDn_a4l;8rMid7|X0sLg#Z0hQQxN&U}|b)C46}3o5li*{g*gJxhG_DNjF3 zX?-?vAAd@o<-wm)te)-&k0ko>edJkt_&xz0m>VLqOki?y$<01)l$7n>UDMu7yum%3 z{}lhE0E9crfME_}Vzb3b`i z+4APC;8h7L3z1>cZ7mL+;TEg_IQ#gnxwMpJNphL!7S2`v$)o!w=IP8Nvmu0imU&xY zp$M^K%UYzGe;Wfb&kH)EeG(Nk50TFyt#1Je&qX^iwom=A{^Redr>CcFNn $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 -- 2.47.2