From 54eb6da1f8be81e5e6a46d3001b5ba723436d640 Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Fri, 20 Jan 2023 09:27:15 -0600 Subject: [PATCH] LU-16477 ldiskfs: Add ext4-enc-flag patch for RHEL9 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 Change-Id: Iaf4ba914fafe6a9e4ad58b74ae63343bb2918a44 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49635 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Yang Sheng Reviewed-by: jsimmons --- .../patches/linux-5.14/ext4-enc-flag.patch | 69 ++++++++++++++++++++++ .../series/ldiskfs-5.14-rhel9.series | 1 + .../series/ldiskfs-5.14.21-sles15sp4.series | 1 + 3 files changed, 71 insertions(+) create mode 100644 ldiskfs/kernel_patches/patches/linux-5.14/ext4-enc-flag.patch 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 index 0000000..3e8e709 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/linux-5.14/ext4-enc-flag.patch @@ -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 + diff --git a/ldiskfs/kernel_patches/series/ldiskfs-5.14-rhel9.series b/ldiskfs/kernel_patches/series/ldiskfs-5.14-rhel9.series index f7cae7d..d738de5 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-5.14-rhel9.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-5.14-rhel9.series @@ -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 diff --git a/ldiskfs/kernel_patches/series/ldiskfs-5.14.21-sles15sp4.series b/ldiskfs/kernel_patches/series/ldiskfs-5.14.21-sles15sp4.series index 33f4c56..e40d556 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-5.14.21-sles15sp4.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-5.14.21-sles15sp4.series @@ -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 -- 1.8.3.1