Correct byteswapping for fast symlinks with xattrs

Fix a problem byte-swapping fast symlinks inodes that contain extended
attributes.

Addresses Red Hat Bugzilla: #232663
Addresses LTC Bugzilla: #27634

Signed-off-by: "Bryn M. Reeves" <breeves@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
bitmap-optimize
Bryn M. Reeves 2007-04-14 14:00:31 -04:00 committed by Theodore Ts'o
parent 0eeb154937
commit 3f4c46e3f9
4 changed files with 20 additions and 18 deletions

View File

@ -1,5 +1,11 @@
2007-04-14 Theodore Tso <tytso@mit.edu>
* pass2.c (e2fsck_process_bad_inode): Remove special kludge that
dealt with long symlinks on big endian systems. It turns
out this was a workaround to a bug described in Red Hat
Bugzilla #232663, with an odd twist. See comment #12 for
more details.
* pass1.c, pass2.c, util.c: Add better ehandler_operation()
markers so it is clearer what e2fsck was doing when an I/O
error is reported.

View File

@ -1202,22 +1202,6 @@ extern int e2fsck_process_bad_inode(e2fsck_t ctx, ext2_ino_t dir,
!(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
if (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++;

View File

@ -1,3 +1,9 @@
2007-04-14 Theodore Tso <tytso@mit.edu>
* swapfs.c (ext2fs_swap_inode_full): Fix a problem byte-swapping
fast symlinks inodes that contain extended attributes.
(Addresses Red Hat Bugzilla #232663, LTC bugzilla #27634)
2007-04-06 Theodore Tso <tytso@mit.edu>
* icount.c (ext2fs_create_icount_tdb): Add support for using TDB

View File

@ -133,7 +133,7 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
struct ext2_inode_large *f, int hostorder,
int bufsize)
{
unsigned i;
unsigned i, has_data_blocks;
int islnk = 0;
__u32 *eaf, *eat;
@ -150,11 +150,17 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
t->i_dtime = ext2fs_swab32(f->i_dtime);
t->i_gid = ext2fs_swab16(f->i_gid);
t->i_links_count = ext2fs_swab16(f->i_links_count);
if (hostorder)
has_data_blocks = ext2fs_inode_data_blocks(fs,
(struct ext2_inode *) f);
t->i_blocks = ext2fs_swab32(f->i_blocks);
if (!hostorder)
has_data_blocks = ext2fs_inode_data_blocks(fs,
(struct ext2_inode *) t);
t->i_flags = ext2fs_swab32(f->i_flags);
t->i_file_acl = ext2fs_swab32(f->i_file_acl);
t->i_dir_acl = ext2fs_swab32(f->i_dir_acl);
if (!islnk || ext2fs_inode_data_blocks(fs, (struct ext2_inode *)t)) {
if (!islnk || has_data_blocks ) {
for (i = 0; i < EXT2_N_BLOCKS; i++)
t->i_block[i] = ext2fs_swab32(f->i_block[i]);
} else if (t != f) {