From: Theodore Ts'o Date: Fri, 28 Jan 2005 17:27:35 +0000 (-0500) Subject: pass2.c (e2fsck_process_bad_inode): Fix a corner case involving X-Git-Tag: E2FSPROGS-1_36~12 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=a894eb47952040cd48da125f3cfd1aa8e3f925a1;p=tools%2Fe2fsprogs.git pass2.c (e2fsck_process_bad_inode): Fix a corner case involving big-endian systems, long symlinks and i_file_acl set when it shouldn't be. Without this bugfix, f_clear_xattr will fail on big-endian machines. --- diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 71b9b44..fbe6401 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,5 +1,10 @@ 2005-01-28 Theodore Ts'o + * pass2.c (e2fsck_process_bad_inode): Fix a corner case involving + big-endian systems, long symlinks and i_file_acl set when + it shouldn't be. Without this bugfix, f_clear_xattr will + fail on big-endian machines. + * super.c (check_resize_inode): Deal with the case where the resize inode can't be read; don't try to recreate the resize inode unless the resize feature is actually diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c index 9719141..dffaae7 100644 --- a/e2fsck/pass2.c +++ b/e2fsck/pass2.c @@ -1194,6 +1194,21 @@ extern int e2fsck_process_bad_inode(e2fsck_t ctx, ext2_ino_t dir, !(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR) && fix_problem(ctx, PR_2_FILE_ACL_ZERO, &pctx)) { inode.i_file_acl = 0; +#ifdef EXT2FS_ENABLE_SWAPFS + /* + * This is a special kludge to deal with long symlinks + * on big endian systems. i_blocks had already been + * decremented earlier in pass 1, but since i_file_acl + * hadn't yet been cleared, ext2fs_read_inode() + * assumed that the file was short symlink and would + * not have byte swapped i_block[0]. Hence, we have + * to byte-swap it here. + */ + if (LINUX_S_ISLNK(inode.i_mode) && + (fs->flags & EXT2_FLAG_SWAP_BYTES) && + (inode.i_blocks == fs->blocksize >> 9)) + inode.i_block[0] = ext2fs_swab32(inode.i_block[0]); +#endif inode_modified++; } else not_fixed++;