1 ext4, dax: set ext4_dax_aops for dax files
3 From: Toshi Kani <toshi.kani@hpe.com>
5 Sync syscall to DAX file needs to flush processor cache, but it
6 currently does not flush to existing DAX files. This is because
7 'ext4_da_aops' is set to address_space_operations of existing DAX
8 files, instead of 'ext4_dax_aops', since S_DAX flag is set after
9 ext4_set_aops() in the open path.
16 ext4_set_inode_flags // Set S_DAX flag
17 ext4_set_aops // Set aops to ext4_dax_aops
24 ext4_set_aops // Set aops to ext4_da_aops
25 ext4_set_inode_flags // Set S_DAX flag
27 Change ext4_iget() to initialize i_flags before ext4_set_aops().
29 Fixes: 5f0663bb4a64 ("ext4, dax: introduce ext4_dax_aops")
30 Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
31 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
32 Suggested-by: Jan Kara <jack@suse.cz>
33 Cc: stable@vger.kernel.org
35 fs/ext4/inode.c | 2 +-
36 1 file changed, 1 insertion(+), 1 deletion(-)
38 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
39 index e4acaa980467..b19387b75f2b 100644
42 @@ -4896,6 +4896,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
43 * not initialized on a new filesystem. */
45 ei->i_flags = le32_to_cpu(raw_inode->i_flags);
46 + ext4_set_inode_flags(inode);
47 inode->i_blocks = ext4_inode_blocks(raw_inode, ei);
48 ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl_lo);
49 if (ext4_has_feature_64bit(sb))
50 @@ -5042,7 +5043,6 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
54 - ext4_set_inode_flags(inode);
56 unlock_new_inode(inode);