diff options
author | Jan Kara <jack@suse.cz> | 2016-11-20 17:32:59 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-11-20 17:32:59 -0500 |
commit | a3caa24b703794507bf2e0a68bdc800b90f5e70b (patch) | |
tree | b133b0f2c3a4e61904a2be8a97b1dd63617453fe /fs/ext4/inode.c | |
parent | 213bcd9ccbf04b709e4764ad89aaaa66a47785f0 (diff) | |
download | op-kernel-dev-a3caa24b703794507bf2e0a68bdc800b90f5e70b.zip op-kernel-dev-a3caa24b703794507bf2e0a68bdc800b90f5e70b.tar.gz |
ext4: only set S_DAX if DAX is really supported
Currently we have S_DAX set inode->i_flags for a regular file whenever
ext4 is mounted with dax mount option. However in some cases we cannot
really do DAX - e.g. when inode is marked to use data journalling, when
inode data is being encrypted, or when inode is stored inline. Make sure
S_DAX flag is appropriately set/cleared in these cases.
Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index b1b4c85..733fda1 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4368,7 +4368,9 @@ void ext4_set_inode_flags(struct inode *inode) new_fl |= S_NOATIME; if (flags & EXT4_DIRSYNC_FL) new_fl |= S_DIRSYNC; - if (test_opt(inode->i_sb, DAX) && S_ISREG(inode->i_mode)) + if (test_opt(inode->i_sb, DAX) && S_ISREG(inode->i_mode) && + !ext4_should_journal_data(inode) && !ext4_has_inline_data(inode) && + !ext4_encrypted_inode(inode)) new_fl |= S_DAX; inode_set_flags(inode, new_fl, S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|S_DAX); @@ -5641,6 +5643,11 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val) ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); } ext4_set_aops(inode); + /* + * Update inode->i_flags after EXT4_INODE_JOURNAL_DATA was updated. + * E.g. S_DAX may get cleared / set. + */ + ext4_set_inode_flags(inode); jbd2_journal_unlock_updates(journal); percpu_up_write(&sbi->s_journal_flag_rwsem); |