From: Theodore Ts'o Date: Sat, 14 Apr 2007 16:01:39 +0000 (-0400) Subject: Fix e2fsck's check_is_really_dir logic X-Git-Tag: E2FSPROGS-1_40~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0eeb15493755329fe4d85be913d5eff657cefec3;p=thirdparty%2Fe2fsprogs.git Fix e2fsck's check_is_really_dir logic Fix a typo which could cause e2fsck to throw an I/O error while doubling checking whether or not a special device file was really an inode. Also, don't do this tests on symbolic links since for filesystems with a large numbers of symlinks it could degrade performance and increases the risk for false positives. Signed-off-by: "Theodore Ts'o" --- diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 2795e464c..7fc700a05 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -4,6 +4,14 @@ markers so it is clearer what e2fsck was doing when an I/O error is reported. + *pass1.c (check_is_really_dir): Fix a typo which could cause + e2fsck to throw an I/O error while doubling checking + whether or not a special device file was really an inode. + Also, don't do this tests on symbolic links since for + filesystems with a large numbers of symlinks it could + degrade performance and increases the risk for false + positives. + 2007-04-10 Jim Garlick * pass1b.c (search_dirent_proc): if a file has multiple hard diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 628157385..19b88649e 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -391,10 +391,10 @@ static void check_is_really_dir(e2fsck_t ctx, struct problem_context *pctx, int i, not_device = 0; if (LINUX_S_ISDIR(inode->i_mode) || LINUX_S_ISREG(inode->i_mode) || - inode->i_block[0] == 0) + LINUX_S_ISLNK(inode->i_mode) || inode->i_block[0] == 0) return; - for (i=1; i < EXT2_N_BLOCKS; i++) { + for (i=0; i < EXT2_N_BLOCKS; i++) { blk = inode->i_block[i]; if (!blk) continue; @@ -411,9 +411,6 @@ static void check_is_really_dir(e2fsck_t ctx, struct problem_context *pctx, (inode->i_links_count == 1) && !not_device) return; - if (LINUX_S_ISLNK(inode->i_mode) && inode->i_links_count == 1) - return; - old_op = ehandler_operation(_("reading directory block")); retval = ext2fs_read_dir_block(ctx->fs, inode->i_block[0], buf); ehandler_operation(0);