diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-29 17:30:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-29 17:30:19 -0400 |
commit | de329820e920cd9cfbc2127cad26a37026260cce (patch) | |
tree | c392dbee75854e1f0b950f9d16dcf03214c63e80 /include | |
parent | ad4ba059005f18ec9e274966c16d99fc5ce8b2cd (diff) |
ext3: fix broken handling of EXT3_STATE_NEW
In commit 9df93939b735 ("ext3: Use bitops to read/modify
EXT3_I(inode)->i_state") ext3 changed its internal 'i_state' variable to
use bitops for its state handling. However, unline the same ext4
change, it didn't actually change the name of the field when it changed
the semantics of it.
As a result, an old use of 'i_state' remained in fs/ext3/ialloc.c that
initialized the field to EXT3_STATE_NEW. And that does not work
_at_all_ when we're now working with individually named bits rather than
values that get masked. So the code tried to mark the state to be new,
but in actual fact set the field to EXT3_STATE_JDATA. Which makes no
sense at all, and screws up all the code that checks whether the inode
was newly allocated.
In particular, it made the xattr code unhappy, and caused various random
behavior, like apparently
https://bugzilla.redhat.com/show_bug.cgi?id=577911
So fix the initialization, and rename the field to match ext4 so that we
don't have this happen again.
Cc: James Morris <jmorris@namei.org>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Daniel J Walsh <dwalsh@redhat.com>
Cc: Eric Paris <eparis@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ext3_fs.h | 6 | ||||
-rw-r--r-- | include/linux/ext3_fs_i.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index cac84b006667..5f494b465097 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
@@ -565,17 +565,17 @@ enum { | |||
565 | 565 | ||
566 | static inline int ext3_test_inode_state(struct inode *inode, int bit) | 566 | static inline int ext3_test_inode_state(struct inode *inode, int bit) |
567 | { | 567 | { |
568 | return test_bit(bit, &EXT3_I(inode)->i_state); | 568 | return test_bit(bit, &EXT3_I(inode)->i_state_flags); |
569 | } | 569 | } |
570 | 570 | ||
571 | static inline void ext3_set_inode_state(struct inode *inode, int bit) | 571 | static inline void ext3_set_inode_state(struct inode *inode, int bit) |
572 | { | 572 | { |
573 | set_bit(bit, &EXT3_I(inode)->i_state); | 573 | set_bit(bit, &EXT3_I(inode)->i_state_flags); |
574 | } | 574 | } |
575 | 575 | ||
576 | static inline void ext3_clear_inode_state(struct inode *inode, int bit) | 576 | static inline void ext3_clear_inode_state(struct inode *inode, int bit) |
577 | { | 577 | { |
578 | clear_bit(bit, &EXT3_I(inode)->i_state); | 578 | clear_bit(bit, &EXT3_I(inode)->i_state_flags); |
579 | } | 579 | } |
580 | #else | 580 | #else |
581 | /* Assume that user mode programs are passing in an ext3fs superblock, not | 581 | /* Assume that user mode programs are passing in an ext3fs superblock, not |
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h index 7679acdb519a..f42c098aed8d 100644 --- a/include/linux/ext3_fs_i.h +++ b/include/linux/ext3_fs_i.h | |||
@@ -87,7 +87,7 @@ struct ext3_inode_info { | |||
87 | * near to their parent directory's inode. | 87 | * near to their parent directory's inode. |
88 | */ | 88 | */ |
89 | __u32 i_block_group; | 89 | __u32 i_block_group; |
90 | unsigned long i_state; /* Dynamic state flags for ext3 */ | 90 | unsigned long i_state_flags; /* Dynamic state flags for ext3 */ |
91 | 91 | ||
92 | /* block reservation info */ | 92 | /* block reservation info */ |
93 | struct ext3_block_alloc_info *i_block_alloc_info; | 93 | struct ext3_block_alloc_info *i_block_alloc_info; |