From 218a4864ec381655f4d5a64d264524c725ae4b70 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sat, 21 Feb 1998 01:41:39 +0000 Subject: [PATCH] .del-ChangeLog~905e7699, image.gz: Set the immutable flag on the block and character device so that e2fsck notices them as bad devices, and offers to fix them. E2fsck currently only checks devices with the immutable flag set, since otherwise there might be some false positives --- the kernel doesn't always clear the all of i_blocks[n], n>=4, due to a race condition. ChangeLog, inode.c: inode.c (ext2fs_get_next_inode): Always do the check to see if the inode table is missing so that we catch the case where the first block group is missing. --- lib/ext2fs/ChangeLog | 4 ++++ lib/ext2fs/inode.c | 17 +++++++++++------ tests/f_badinode/ChangeLog | 8 ++++++++ tests/f_badinode/image.gz | Bin 1109 -> 1111 bytes 4 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 tests/f_badinode/ChangeLog diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 454a00f..ddc1f76 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,5 +1,9 @@ 1998-02-20 Theodore Y. Ts'o + * inode.c (ext2fs_get_next_inode): Always do the check to see if the + inode table is missing so that we catch the case where the + first block group is missing. + * getsize.c, ismounted.c, unix_io.c: #include errno.h since it's needed. diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c index cceaa95..0edee7f 100644 --- a/lib/ext2fs/inode.c +++ b/lib/ext2fs/inode.c @@ -371,13 +371,18 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino, retval = get_next_blockgroup(scan); if (retval) return retval; - if (scan->current_block == 0) { - if (scan->scan_flags & EXT2_SF_SKIP_MISSING_ITABLE) { - goto retry; - } else - return EXT2_ET_MISSING_INODE_TABLE; - } } + /* + * This is done outside the above if statement so that the + * check can be done for block group #0. + */ + if (scan->current_block == 0) { + if (scan->scan_flags & EXT2_SF_SKIP_MISSING_ITABLE) { + goto retry; + } else + return EXT2_ET_MISSING_INODE_TABLE; + } + /* * Have we run out of space in the inode buffer? If so, we diff --git a/tests/f_badinode/ChangeLog b/tests/f_badinode/ChangeLog new file mode 100644 index 0000000..2edd33f --- /dev/null +++ b/tests/f_badinode/ChangeLog @@ -0,0 +1,8 @@ +1998-02-20 Theodore Y. Ts'o + + * Set the immutable flag on the block and character device so that + e2fsck notices them as bad devices, and offers to fix them. + E2fsck currently only checks devices with the immutable + flag set, since otherwise there might be some false + positives --- the kernel doesn't always clear the all of + i_blocks[n], n>=4, due to a race condition. diff --git a/tests/f_badinode/image.gz b/tests/f_badinode/image.gz index e399c4b190705b92a3424f59e71ac62c322facd3..6beecc8b1d43aa33907fc2d4a52f070da4b69d33 100644 GIT binary patch delta 968 zcmV;(12_ED2-gT7ABzYGfhq1Z0t0DnVP|Ck?b}Un+(a0_@kvrdZ33i`9~ytBU3Fio z-A&Y-Dh?cb=y&J|i4VYqZ_pcOJ^`qz;J__BervZPIY329mH*FrsUt=$=d#pGDq! zh8+B-0>G))pXj9P-?Dmpp`0h-OS~enD)FksYZ9+ZthN6)eM90+iS>VQ{dxbMQdeaC zyX5Vn+iQ7Y-*^6_>)-uvmHKE!sh_|8aifcq^1t_t`9E0PaA6^TuUUV8C)fQh7F)g6 z)p0^6ev$Y=;wOoR|F-{a$L{{^`{!)(0{{S=wdQ_yNd@&CuTp=kEUO@3T!3>!p2wK~ z0P~;u4>11$F#iEC{{b-n0WkjoF#iEC{{b-n0Wkjo{Qp&Re)0GJtE!p*)q4T!%2&h5 zZ2sZ?+erdpE!7mxni-cVq9b zTvU5EdedqXqYVH6006-A;a@F>dy`SA=M%j>7$4l$JKH*V#dAoy=)Zl6TarN{6nSA(kJn5G+-w*rc zVL0pe?56+uCs#d}X4Z@2qDXVC<0vTdDAaKfnPyc)o{f!lp^ehq<(@0T#AJo_zu3Ow zxh&7UG;$`fo|JzHjJ2Uo0#ogq1i3kF-#T$-Qr9N-B(IbRwGFbY&YPL2&QKR>GH7F^ zJxLmB7uZNjrGd?(rY>U(X-Qj|O@r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