]> git.itanic.dy.fi Git - linux-stable/commitdiff
ext4: allow the dax flag to be set and cleared on inline directories
authorTheodore Ts'o <tytso@mit.edu>
Mon, 12 Apr 2021 21:19:00 +0000 (17:19 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 13 Apr 2021 03:33:01 +0000 (23:33 -0400)
This is needed to allow generic/607 to pass for file systems with the
inline data_feature enabled, and it allows the use of file systems
where the directories use inline_data, while the files are accessed
via DAX.

Cc: stable@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/ialloc.c
fs/ext4/ioctl.c

index 5f0c7fe326720b59e5eab0a512f47371eb154879..71d321b3b984493a7c0bb33dd4205ce553842820 100644 (file)
@@ -1292,7 +1292,8 @@ struct inode *__ext4_new_inode(struct user_namespace *mnt_userns,
 
        ei->i_extra_isize = sbi->s_want_extra_isize;
        ei->i_inline_off = 0;
-       if (ext4_has_feature_inline_data(sb))
+       if (ext4_has_feature_inline_data(sb) &&
+           (!(ei->i_flags & EXT4_DAX_FL) || S_ISDIR(mode)))
                ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
        ret = inode;
        err = dquot_alloc_inode(inode);
index a2cf35066f46be5059d8f3d9b2000f845bd5aa85..0796bfa72829c708b71989aeafbf04fc18a58410 100644 (file)
@@ -315,6 +315,12 @@ static void ext4_dax_dontcache(struct inode *inode, unsigned int flags)
 static bool dax_compatible(struct inode *inode, unsigned int oldflags,
                           unsigned int flags)
 {
+       /* Allow the DAX flag to be changed on inline directories */
+       if (S_ISDIR(inode->i_mode)) {
+               flags &= ~EXT4_INLINE_DATA_FL;
+               oldflags &= ~EXT4_INLINE_DATA_FL;
+       }
+
        if (flags & EXT4_DAX_FL) {
                if ((oldflags & EXT4_DAX_MUT_EXCL) ||
                     ext4_test_inode_state(inode,