Whamcloud - gitweb
LU-16477 ldiskfs: Add ext4-enc-flag patch for RHEL9 35/49635/7
authorShaun Tancheff <shaun.tancheff@hpe.com>
Fri, 20 Jan 2023 15:27:15 +0000 (09:27 -0600)
committerOleg Drokin <green@whamcloud.com>
Wed, 8 Feb 2023 06:26:37 +0000 (06:26 +0000)
Update ext4-enc-flag for linux 5.14 and include it
the 5.14 based RHEL9 and SUSE 15 SP4 ldiskfs series

Test-Parameters: trivial
HPE-bug-id: LUS-11442
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: Iaf4ba914fafe6a9e4ad58b74ae63343bb2918a44
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49635
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: jsimmons <jsimmons@infradead.org>
ldiskfs/kernel_patches/patches/linux-5.14/ext4-enc-flag.patch [new file with mode: 0644]
ldiskfs/kernel_patches/series/ldiskfs-5.14-rhel9.series
ldiskfs/kernel_patches/series/ldiskfs-5.14.21-sles15sp4.series

diff --git a/ldiskfs/kernel_patches/patches/linux-5.14/ext4-enc-flag.patch b/ldiskfs/kernel_patches/patches/linux-5.14/ext4-enc-flag.patch
new file mode 100644 (file)
index 0000000..3e8e709
--- /dev/null
@@ -0,0 +1,69 @@
+Subject: [PATCH] ext4-enc-flag
+
+---
+ fs/ext4/ext4.h  | 3 +++
+ fs/ext4/inode.c | 6 ++++--
+ fs/ext4/xattr.c | 8 +++++++-
+ 3 files changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
+index 0144c3a..848b7bb 100644
+--- a/fs/ext4/ext4.h
++++ b/fs/ext4/ext4.h
+@@ -1242,6 +1242,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 --git a/fs/ext4/inode.c b/fs/ext4/inode.c
+index 2de9443..97649e9 100644
+--- a/fs/ext4/inode.c
++++ b/fs/ext4/inode.c
+@@ -4536,7 +4536,8 @@ void ext4_set_inode_flags(struct inode *inode, bool init)
+       if (init && ext4_should_enable_dax(inode))
+               new_fl |= S_DAX;
+-      if (flags & EXT4_ENCRYPT_FL)
++      if (flags & EXT4_ENCRYPT_FL &&
++          unlikely(!IS_LUSTRE_MOUNT(inode->i_sb)))
+               new_fl |= S_ENCRYPTED;
+       if (flags & EXT4_CASEFOLD_FL)
+               new_fl |= S_CASEFOLD;
+@@ -5576,7 +5577,8 @@ int ext4_getattr(struct user_namespace *mnt_userns, const struct path *path,
+               stat->attributes |= STATX_ATTR_APPEND;
+       if (flags & EXT4_COMPR_FL)
+               stat->attributes |= STATX_ATTR_COMPRESSED;
+-      if (flags & EXT4_ENCRYPT_FL)
++      if (flags & EXT4_ENCRYPT_FL &&
++          unlikely(!IS_LUSTRE_MOUNT(inode->i_sb)))
+               stat->attributes |= STATX_ATTR_ENCRYPTED;
+       if (flags & EXT4_IMMUTABLE_FL)
+               stat->attributes |= STATX_ATTR_IMMUTABLE;
+diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
+index 9800ef9..99eaf86 100644
+--- a/fs/ext4/xattr.c
++++ b/fs/ext4/xattr.c
+@@ -2496,8 +2496,14 @@ retry_inode:
+               if (IS_SYNC(inode))
+                       ext4_handle_sync(handle);
+       }
+-      ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR);
++      if (!error && name_index == EXT4_XATTR_INDEX_ENCRYPTION &&
++          strcmp(name, "c") == 0) {
++              EXT4_I(inode)->i_flags |= EXT4_ENCRYPT_FL;
++              mark_inode_dirty(inode);
++      }
++
++      ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR);
+ cleanup:
+       brelse(is.iloc.bh);
+       brelse(bs.bh);
+-- 
+2.34.1
+
index f7cae7d..d738de5 100644 (file)
@@ -30,3 +30,4 @@ base/ext4-delayed-iput.patch
 linux-5.14/ext4-xattr-disable-credits-check.patch
 linux-5.10/ext4-fiemap-kernel-data.patch
 rhel8/ext4-old_ea_inodes_handling_fix.patch
+linux-5.14/ext4-enc-flag.patch
index 33f4c56..e40d556 100644 (file)
@@ -30,3 +30,4 @@ base/ext4-delayed-iput.patch
 linux-5.14/ext4-xattr-disable-credits-check.patch
 linux-5.10/ext4-fiemap-kernel-data.patch
 rhel8/ext4-old_ea_inodes_handling_fix.patch
+linux-5.14/ext4-enc-flag.patch