Commit d91341a9 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ext3: fix determination of inode journalling mode

The test for whether an inode is using journalled, ordered or writeback data
is incorrect and can lead to ext3_set_aops() giving the inode the wrong set
of address_space_operations.  Fix.  (Spotted by Jan Kara).
parent 7766a93b
...@@ -221,13 +221,24 @@ static inline int ext3_should_journal_data(struct inode *inode) ...@@ -221,13 +221,24 @@ static inline int ext3_should_journal_data(struct inode *inode)
static inline int ext3_should_order_data(struct inode *inode) static inline int ext3_should_order_data(struct inode *inode)
{ {
return (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA); if (!S_ISREG(inode->i_mode))
return 0;
if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL)
return 0;
if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA)
return 1;
return 0;
} }
static inline int ext3_should_writeback_data(struct inode *inode) static inline int ext3_should_writeback_data(struct inode *inode)
{ {
return !ext3_should_journal_data(inode) && if (!S_ISREG(inode->i_mode))
!ext3_should_order_data(inode); return 0;
if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL)
return 0;
if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA)
return 1;
return 0;
} }
#endif /* _LINUX_EXT3_JBD_H */ #endif /* _LINUX_EXT3_JBD_H */
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