Whamcloud - gitweb
LU-15848 ldiskfs: escape encrypted file names
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / linux-5.8 / ext4-enc-flag.patch
index d8f2b22..966120a 100644 (file)
@@ -1,3 +1,16 @@
+diff -wur a/fs/ext4/ext4.h b/fs/ext4/ext4.h
+--- a/fs/ext4/ext4.h
++++ b/fs/ext4/ext4.h
+@@ -1154,6 +1154,9 @@ struct ext4_inode_info {
+ #define EXT4_MOUNT_DISCARD            0x40000000 /* Issue DISCARD requests */
+ #define EXT4_MOUNT_INIT_INODE_TABLE   0x80000000 /* Initialize uninitialized itables */
++/* we know this is a Lustre mount thanks to the DIRDATA flag */
++#define IS_LUSTRE_MOUNT(sb)   test_opt((sb), DIRDATA)
++
+ /*
+  * Mount flags set either automatically (could not be set by mount option)
+  * based on per file system feature or property or in special cases such as
 diff -wur a/fs/ext4/inode.c b/fs/ext4/inode.c
 --- a/fs/ext4/inode.c
 +++ b/fs/ext4/inode.c
@@ -7,7 +20,7 @@ diff -wur a/fs/ext4/inode.c b/fs/ext4/inode.c
  
 -      if (flags & EXT4_ENCRYPT_FL)
 +      if (flags & EXT4_ENCRYPT_FL &&
-+          unlikely(test_opt(inode->i_sb, DIRDATA) != EXT4_MOUNT_DIRDATA))
++          unlikely(!IS_LUSTRE_MOUNT(inode->i_sb)))
                new_fl |= S_ENCRYPTED;
        if (flags & EXT4_CASEFOLD_FL)
                new_fl |= S_CASEFOLD;
@@ -18,7 +31,7 @@ diff -wur a/fs/ext4/inode.c b/fs/ext4/inode.c
                stat->attributes |= STATX_ATTR_COMPRESSED;
 -      if (flags & EXT4_ENCRYPT_FL)
 +      if (flags & EXT4_ENCRYPT_FL &&
-+          unlikely(test_opt(inode->i_sb, DIRDATA) != EXT4_MOUNT_DIRDATA))
++          unlikely(!IS_LUSTRE_MOUNT(inode->i_sb)))
                stat->attributes |= STATX_ATTR_ENCRYPTED;
        if (flags & EXT4_IMMUTABLE_FL)
                stat->attributes |= STATX_ATTR_IMMUTABLE;