Patchwork [4/4] tests: add test for resize2fs -M with inode table in middle of block group

login
register
mail settings
Submitter Theodore Ts'o
Date Oct. 1, 2013, 3:59 a.m.
Message ID <1380599974-2886-4-git-send-email-tytso@mit.edu>
Download mbox | patch
Permalink /patch/279329/
State Accepted
Headers show

Comments

Theodore Ts'o - Oct. 1, 2013, 3:59 a.m.
Eric Sandeen reported that Fedora's mke2fs when compiled for ppc was
creating a file system which caused problems with resize2fs -M.
Closer examination showed that the problem was file system which
looked like this:

Filesystem features:      ext_attr dir_index filetype sparse_super
Inode count:              512
Block count:              1247
   ...

Group 0: (Blocks 1-1024)
  Primary superblock at 1, Group descriptors at 2-2
  Block bitmap at 66 (+65), Inode bitmap at 67 (+66)
  Inode table at 68-99 (+67)

Group 1: (Blocks 1025-1246)
  Backup superblock at 1025, Group descriptors at 1026-1026
  Block bitmap at 1090 (+65), Inode bitmap at 1091 (+66)
  Inode table at 1092-1123 (+67)

It's not obvious to me why Fedora's ppc mke2fs is creating file
systems like this (I can't reproduce this on debian ppc systems), but
resize2fs -M should be able to deal with such file systems, which is
what this test is designed to check.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 tests/r_min_itable/expect   |  14 ++++++++++++++
 tests/r_min_itable/image.gz | Bin 0 -> 3597 bytes
 tests/r_min_itable/name     |   1 +
 tests/r_min_itable/script   |  43 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 58 insertions(+)
 create mode 100644 tests/r_min_itable/expect
 create mode 100644 tests/r_min_itable/image.gz
 create mode 100644 tests/r_min_itable/name
 create mode 100644 tests/r_min_itable/script

Patch

diff --git a/tests/r_min_itable/expect b/tests/r_min_itable/expect
new file mode 100644
index 0000000..104688a
--- /dev/null
+++ b/tests/r_min_itable/expect
@@ -0,0 +1,14 @@ 
+resize2fs test
+resize2fs -M test.img
+Resizing the filesystem on test.img to 1124 (1k) blocks.
+The filesystem on test.img is now 1124 blocks long.
+
+Exit status is 0
+e2fsck 1.42.8 (20-Jun-2013)
+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_filesys: 13/512 files (0.0% non-contiguous), 1120/1124 blocks
+Exit status is 0
diff --git a/tests/r_min_itable/image.gz b/tests/r_min_itable/image.gz
new file mode 100644
index 0000000000000000000000000000000000000000..7c40c5661c86c8fc81e5c73b2adfe1658666df2c
GIT binary patch
literal 3597
zc-rNbTToMX9>?k00#l3Z=q^|opdDM?4im(o(QOo|f}kQ7K_EG~p{`O70$TR~1_COz
zw2Q&*x}pX_E&{oni?;(3xu~onML_HMClWT`WlhRI4Hw~%5)9d$KJ3gs?L()1@$>k7
z`F$Tg^P6u_nWvkKw>9ZE3v8x6f5l&%JMwh>p?J>?i{Ja;{kNmu|Lw;2Lh?PM9$f$C
z&Ad;p-}o<U3nJ6cm@eI*Q+oFLl3H{1tgf?qbhO2BxXJbBzI3;?3@<PD7RAzc8sPz2
zhCWUY{lR95X&bCe8(udWch%c{$vfu4{g3_A+7BMCh#CH)U2j)Nw1%i+=VXqk^T`*>
zGEDMk0t??_{P6C2`Q49vof+$xhOt1ob3ukO>+#!RIi2H3o`Po>3bOEX){({cUfy;I
z9)W3YWL$VY8v07Hvv_DWBwiZEe4KOQrDvJD+s|Sm<l|R;6xHG0W;x-Kj(huf4z~|0
zr!FsV-#63Z7%6m4-n%CEn~b+d><XQ39_kCboymPNZk;yRFZ7J;bG_?#!v3FhXg*BZ
zCtb)KqZ2uzGNz8^b0o2^yk|77LYKcIZ*Jsot{P_!%XKfYbT73Aj1@mlKfm2&%Z<fc
z%Q8oi#tPyEI*Zh%;-}FUNJA>Iuk>)y8*Z;DZNj)U`$NwbeHMCl=XLssT{&9mdKZ>*
zcRN*kHRr6|>?y}SC%#uL$ZS@&n^m7!Eo_-%k5f}5?o^NH$Dy4qb?oj-Db_?7r0AHk
z$xO_m^GJ;kejI&@T=XICpp!^l1>S)Ei6ic1uFxWmG?@7dokWPVjD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2fs -M with inode table in middle of last block group
diff --git a/tests/r_min_itable/script b/tests/r_min_itable/script
new file mode 100644
index 0000000..00aaa60
--- /dev/null
+++ b/tests/r_min_itable/script
@@ -0,0 +1,43 @@ 
+if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
+
+IMAGE=$test_dir/image.gz
+FSCK_OPT=-yf
+OUT=$test_name.log
+EXP=$test_dir/expect
+
+gunzip < $IMAGE > $TMPFILE
+
+echo "resize2fs test" > $OUT
+
+echo "resize2fs -M test.img" >> $OUT
+$RESIZE2FS -M $TMPFILE 2>&1 >> $OUT.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT.new
+sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
+
+$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1 
+echo Exit status is $status >> $OUT
+
+rm $TMPFILE $OUT.new
+
+#
+# Do the verification
+#
+
+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
+fi
+
+unset IMAGE FSCK_OPT OUT EXP
+
+else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
+	echo "$test_name: $test_description: skipped"
+fi
+