From d4dc0a9e29f9e50a46840bc130c6a816c4c7faa5 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 27 Jan 2005 18:47:51 -0500 Subject: [PATCH] Create the resize inode is created even if the s_reserved_gdt_blocks is zero; e2fsck will now complain and recreate the resize inode if i_links_count is zero or if it is not a regular file. --- e2fsck/ChangeLog | 4 ++++ e2fsck/super.c | 3 ++- lib/ext2fs/ChangeLog | 5 +++++ lib/ext2fs/res_gdt.c | 2 -- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index c10fa86..c3c98f5 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,5 +1,9 @@ 2005-01-27 Theodore Ts'o + * super.c (check_resize_inode): If the resize inode has a zero + i_links_count or isn't a regular file, consider the resize + inode as invalid, and offer to recreate it. + * pass2.c (e2fsck_process_bad_inode): Offer to clear i_file_acl before checking to see if an invalid inode should be removed, since otherwise the fast symlink detection code diff --git a/e2fsck/super.c b/e2fsck/super.c index f508c4e..e48a030 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -372,7 +372,8 @@ void check_resize_inode(e2fsck_t ctx) if (i != EXT2_DIND_BLOCK && inode.i_block[i]) break; } - if ((i < EXT2_N_BLOCKS) || !blk || + if ((i < EXT2_N_BLOCKS) || !blk || !inode.i_links_count || + !(inode.i_mode & LINUX_S_IFREG) || (blk < fs->super->s_first_data_block || blk >= fs->super->s_blocks_count)) { resize_inode_invalid: diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index c7c8d01..ce986aa 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,8 @@ +2005-01-27 Theodore Ts'o + + * res_gdt.c (ext2fs_create_resize_inode): Create the resize inode + even if s_reserved_gdt_blocks is zero. + 2005-01-26 Theodore Ts'o * ext2fs.pc.in: Add pkg-config files. diff --git a/lib/ext2fs/res_gdt.c b/lib/ext2fs/res_gdt.c index 1fdb1d4..8b4ddca 100644 --- a/lib/ext2fs/res_gdt.c +++ b/lib/ext2fs/res_gdt.c @@ -72,8 +72,6 @@ errcode_t ext2fs_create_resize_inode(ext2_filsys fs) EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); sb = fs->super; - if (!sb->s_reserved_gdt_blocks) - return 0; retval = ext2fs_get_mem(2 * fs->blocksize, (void **)&dindir_buf); if (retval) -- 1.8.3.1