Commit 8183c4b2 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Linus Torvalds

[PATCH] ext3/ea: ix i_extra_isize check

We are checking for (EXT3_SB(inode->i_sb)->s_inode_size <=
EXT3_GOOD_OLD_INODE_SIZE) to find out if we can set in-inode attributes;
the test fails for inodes that have been created before the ea-in-inode
patch.  Those inodes have (i_extra_isize == 0), so we end up with the
attributes overlapping the i_extra_isize field.  Checking for
(i_extra_isize == 0) instead fixes this case.

The EXT3_STATE_XATTR flag is only set if (i_extra_isize > 0) and the inodes
has in-inode attributes, so that is enough in the first two tests.
Signed-off-by: default avatarAndreas Gruenbacher <agruen@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 53a6bb2f
...@@ -272,8 +272,7 @@ ext3_xattr_ibody_get(struct inode *inode, int name_index, const char *name, ...@@ -272,8 +272,7 @@ ext3_xattr_ibody_get(struct inode *inode, int name_index, const char *name,
void *end; void *end;
int error; int error;
if (EXT3_SB(inode->i_sb)->s_inode_size <= EXT3_GOOD_OLD_INODE_SIZE || if (!(EXT3_I(inode)->i_state & EXT3_STATE_XATTR))
!(EXT3_I(inode)->i_state & EXT3_STATE_XATTR))
return -ENODATA; return -ENODATA;
error = ext3_get_inode_loc(inode, &iloc); error = ext3_get_inode_loc(inode, &iloc);
if (error) if (error)
...@@ -399,8 +398,7 @@ ext3_xattr_ibody_list(struct inode *inode, char *buffer, size_t buffer_size) ...@@ -399,8 +398,7 @@ ext3_xattr_ibody_list(struct inode *inode, char *buffer, size_t buffer_size)
void *end; void *end;
int error; int error;
if (EXT3_SB(inode->i_sb)->s_inode_size <= EXT3_GOOD_OLD_INODE_SIZE || if (!(EXT3_I(inode)->i_state & EXT3_STATE_XATTR))
!(EXT3_I(inode)->i_state & EXT3_STATE_XATTR))
return 0; return 0;
error = ext3_get_inode_loc(inode, &iloc); error = ext3_get_inode_loc(inode, &iloc);
if (error) if (error)
...@@ -865,7 +863,7 @@ ext3_xattr_ibody_find(struct inode *inode, struct ext3_xattr_info *i, ...@@ -865,7 +863,7 @@ ext3_xattr_ibody_find(struct inode *inode, struct ext3_xattr_info *i,
struct ext3_inode *raw_inode; struct ext3_inode *raw_inode;
int error; int error;
if (EXT3_SB(inode->i_sb)->s_inode_size <= EXT3_GOOD_OLD_INODE_SIZE) if (EXT3_I(inode)->i_extra_isize == 0)
return 0; return 0;
raw_inode = ext3_raw_inode(&is->iloc); raw_inode = ext3_raw_inode(&is->iloc);
header = IHDR(inode, raw_inode); header = IHDR(inode, raw_inode);
...@@ -896,7 +894,7 @@ ext3_xattr_ibody_set(handle_t *handle, struct inode *inode, ...@@ -896,7 +894,7 @@ ext3_xattr_ibody_set(handle_t *handle, struct inode *inode,
struct ext3_xattr_search *s = &is->s; struct ext3_xattr_search *s = &is->s;
int error; int error;
if (EXT3_SB(inode->i_sb)->s_inode_size <= EXT3_GOOD_OLD_INODE_SIZE) if (EXT3_I(inode)->i_extra_isize == 0)
return -ENOSPC; return -ENOSPC;
error = ext3_xattr_set_entry(i, s); error = ext3_xattr_set_entry(i, s);
if (error) if (error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment