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).  


---

 include/linux/ext3_jbd.h |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff -puN include/linux/ext3_jbd.h~ext3-journal-mode-fix include/linux/ext3_jbd.h
--- 25/include/linux/ext3_jbd.h~ext3-journal-mode-fix	2004-01-12 08:26:32.000000000 -0800
+++ 25-akpm/include/linux/ext3_jbd.h	2004-01-12 08:26:32.000000000 -0800
@@ -221,13 +221,24 @@ static inline int ext3_should_journal_da
 
 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)
 {
-	return !ext3_should_journal_data(inode) &&
-			!ext3_should_order_data(inode);
+	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_WRITEBACK_DATA)
+		return 1;
+	return 0;
 }
 
 #endif	/* _LINUX_EXT3_JBD_H */

_