Whamcloud - gitweb
pass2.c (e2fsck_process_bad_inode): Fix a corner case involving
authorTheodore Ts'o <tytso@mit.edu>
Fri, 28 Jan 2005 17:27:35 +0000 (12:27 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 28 Jan 2005 17:27:35 +0000 (12:27 -0500)
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.

e2fsck/ChangeLog
e2fsck/pass2.c

index 71b9b44..fbe6401 100644 (file)
@@ -1,5 +1,10 @@
 2005-01-28  Theodore Ts'o  <tytso@mit.edu>
 
+       * 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
index 9719141..dffaae7 100644 (file)
@@ -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++;