From d91341a903501da6249a38f0c35528f176b5f533 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 19 Jan 2004 05:13:05 -0800 Subject: [PATCH] [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). --- include/linux/ext3_jbd.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h index 50caf6875ba4d..a3555b48cccba 100644 --- a/include/linux/ext3_jbd.h +++ b/include/linux/ext3_jbd.h @@ -221,13 +221,24 @@ static inline int ext3_should_journal_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) { - 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 */ -- 2.53.0