From b084d5534a15741094a51ee40c9a1d5e9cfbf5e1 Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Mon, 4 Nov 2024 22:01:49 -0800 Subject: [PATCH] LU-18423 kernel: update RHEL 8.10 [4.18.0-553.27.1.el8_10] Update RHEL 8.10 kernel to 4.18.0-553.27.1.el8_10. Test-Parameters: trivial fstype=ldiskfs mdtcount=4 mdscount=2 \ clientdistro=el8.10 serverdistro=el8.9 testlist=sanity Test-Parameters: trivial fstype=zfs mdtcount=4 mdscount=2 \ clientdistro=el8.10 serverdistro=el8.9 testlist=sanity Test-Parameters: trivial fstype=ldiskfs mdtcount=4 mdscount=2 \ clientdistro=el8.9 serverdistro=el8.10 testlist=sanity Test-Parameters: trivial fstype=zfs mdtcount=4 mdscount=2 \ clientdistro=el8.9 serverdistro=el8.10 testlist=sanity Test-Parameters: optional clientdistro=el8.10 serverdistro=el8.10 \ testgroup=full-part-1 Test-Parameters: optional clientdistro=el8.10 serverdistro=el8.10 \ testgroup=full-part-2 Test-Parameters: optional clientdistro=el8.10 serverdistro=el8.10 \ testgroup=full-part-3 Change-Id: I3737c1f1b2941d2095225f1ab80fd76768c4782c Signed-off-by: Jian Yu --- .../patches/rhel8.10/ext4-delayed-iput.patch | 175 +++++++++++++++++++++ .../series/ldiskfs-4.18-rhel8.10.series | 2 +- lustre/ChangeLog | 4 +- .../kernel_patches/targets/4.18-rhel8.10.target.in | 2 +- lustre/kernel_patches/which_patch | 2 +- 5 files changed, 180 insertions(+), 5 deletions(-) create mode 100644 ldiskfs/kernel_patches/patches/rhel8.10/ext4-delayed-iput.patch diff --git a/ldiskfs/kernel_patches/patches/rhel8.10/ext4-delayed-iput.patch b/ldiskfs/kernel_patches/patches/rhel8.10/ext4-delayed-iput.patch new file mode 100644 index 0000000..acbb482 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/rhel8.10/ext4-delayed-iput.patch @@ -0,0 +1,175 @@ +When changing a large xattr value to a different large xattr value, +the old xattr inode is freed. Truncate during the final iput causes +current transaction restart. Eventually, parent inode bh is marked +dirty and kernel panic happens when jbd2 figures out that this bh +belongs to the committed transaction. + +A possible fix is to call this final iput in a separate thread. +This way, setxattr transactions will never be split into two. +Since the setxattr code adds xattr inodes with nlink=0 into the +orphan list, old xattr inodes will be properly cleaned up in +any case. + +Signed-off-by: Andrew Perepechko +HPE-bug-id: LUS-10534 + +Changes since v1: +- fixed a bug added during the porting +- fixed a workqueue related deadlock reported by Tetsuo Handa +--- + fs/ext4/ext4.h | 7 +++++-- + fs/ext4/page-io.c | 2 +- + fs/ext4/super.c | 15 ++++++++------- + fs/ext4/xattr.c | 39 +++++++++++++++++++++++++++++++++++++-- + 4 files changed, 51 insertions(+), 12 deletions(-) + +diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h +index 3f87cca49f0c..52db5d6bae7f 100644 +--- a/fs/ext4/ext4.h ++++ b/fs/ext4/ext4.h +@@ -1650,8 +1650,11 @@ struct ext4_sb_info { + struct flex_groups * __rcu *s_flex_groups; + ext4_group_t s_flex_groups_allocated; + +- /* workqueue for reserved extent conversions (buffered io) */ +- struct workqueue_struct *rsv_conversion_wq; ++ /* ++ * workqueue for reserved extent conversions (buffered io) ++ * and large ea inodes reclaim ++ */ ++ struct workqueue_struct *s_misc_wq; + + /* timer for periodic error stats printing */ + struct timer_list s_err_report; +diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c +index 495ce59fb4ad..0142b88471ff 100644 +--- a/fs/ext4/page-io.c ++++ b/fs/ext4/page-io.c +@@ -228,7 +228,7 @@ static void ext4_add_complete_io(ext4_io_end_t *io_end) + WARN_ON(!(io_end->flag & EXT4_IO_END_UNWRITTEN)); + WARN_ON(!io_end->handle && sbi->s_journal); + spin_lock_irqsave(&ei->i_completed_io_lock, flags); +- wq = sbi->rsv_conversion_wq; ++ wq = sbi->s_misc_wq; + if (list_empty(&ei->i_rsv_conversion_list)) + queue_work(wq, &ei->i_rsv_conversion_work); + list_add_tail(&io_end->list, &ei->i_rsv_conversion_list); +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index 81749eaddf4c..ee03f593b264 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -1200,8 +1200,9 @@ static void ext4_put_super(struct super_block *sb) + int i, err; + + ext4_unregister_li_request(sb); ++ flush_workqueue(sbi->s_misc_wq); + ext4_quota_off_umount(sb); + +- destroy_workqueue(sbi->rsv_conversion_wq); ++ destroy_workqueue(sbi->s_misc_wq); + + /* +@@ -5294,9 +5295,9 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) + * The maximum number of concurrent works can be high and + * concurrency isn't really necessary. Limit it to 1. + */ +- EXT4_SB(sb)->rsv_conversion_wq = +- alloc_workqueue("ext4-rsv-conversion", WQ_MEM_RECLAIM | WQ_UNBOUND, 1); +- if (!EXT4_SB(sb)->rsv_conversion_wq) { ++ EXT4_SB(sb)->s_misc_wq = ++ alloc_workqueue("ext4-misc", WQ_MEM_RECLAIM | WQ_UNBOUND, 1); ++ if (!EXT4_SB(sb)->s_misc_wq) { + printk(KERN_ERR "EXT4-fs: failed to create workqueue\n"); + ret = -ENOMEM; + goto failed_mount4; +@@ -5514,8 +5515,8 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) + sb->s_root = NULL; + failed_mount4: + ext4_msg(sb, KERN_ERR, "mount failed"); +- if (EXT4_SB(sb)->rsv_conversion_wq) +- destroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq); ++ if (EXT4_SB(sb)->s_misc_wq) ++ destroy_workqueue(EXT4_SB(sb)->s_misc_wq); + failed_mount_wq: + ext4_xattr_destroy_cache(sbi->s_ea_inode_cache); + sbi->s_ea_inode_cache = NULL; +@@ -6129,7 +6130,7 @@ static int ext4_sync_fs(struct super_block *sb, int wait) + return 0; + + trace_ext4_sync_fs(sb, wait); +- flush_workqueue(sbi->rsv_conversion_wq); ++ flush_workqueue(sbi->s_misc_wq); + /* + * Writeback quota in non-journalled quota case - journalled quota has + * no dirty dquots +diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c +index 042325349098..ee13675fbead 100644 +--- a/fs/ext4/xattr.c ++++ b/fs/ext4/xattr.c +@@ -1603,6 +1603,36 @@ out_err: + return ERR_PTR(err); + } + ++struct delayed_iput_work { ++ struct work_struct work; ++ struct inode *inode; ++}; ++ ++static void delayed_iput_fn(struct work_struct *work) ++{ ++ struct delayed_iput_work *diwork; ++ ++ diwork = container_of(work, struct delayed_iput_work, work); ++ iput(diwork->inode); ++ kfree(diwork); ++} ++ ++static void delayed_iput(struct inode *inode, struct delayed_iput_work *work) ++{ ++ if (!inode) { ++ kfree(work); ++ return; ++ } ++ ++ if (!work) { ++ iput(inode); ++ } else { ++ INIT_WORK(&work->work, delayed_iput_fn); ++ work->inode = inode; ++ queue_work(EXT4_SB(inode->i_sb)->s_misc_wq, &work->work); ++ } ++} ++ + /* + * Reserve min(block_size/8, 1024) bytes for xattr entries/names if ea_inode + * feature is enabled. +@@ -1620,6 +1650,7 @@ static int ext4_xattr_set_entry(struct e + size_t min_offs = s->end - s->base, name_len = strlen(i->name); + int in_inode = i->in_inode; + struct inode *old_ea_inode = NULL; ++ struct delayed_iput_work *diwork = NULL; + size_t old_size, new_size; + int ret; + +@@ -1696,7 +1727,11 @@ static int ext4_xattr_set_entry(struct e + * Finish that work before doing any modifications to the xattr data. + */ + if (!s->not_found && here->e_value_inum) { +- ret = ext4_xattr_inode_iget(inode, ++ diwork = kmalloc(sizeof(*diwork), GFP_NOFS); ++ if (!diwork) ++ ret = -ENOMEM; ++ else ++ ret = ext4_xattr_inode_iget(inode, + le32_to_cpu(here->e_value_inum), + le32_to_cpu(here->e_hash), + &old_ea_inode); +@@ -1817,7 +1852,7 @@ update_hash: + + ret = 0; + out: +- iput(old_ea_inode); ++ delayed_iput(old_ea_inode, diwork); + return ret; + } + diff --git a/ldiskfs/kernel_patches/series/ldiskfs-4.18-rhel8.10.series b/ldiskfs/kernel_patches/series/ldiskfs-4.18-rhel8.10.series index ea6a0d1..d016e39 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-4.18-rhel8.10.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-4.18-rhel8.10.series @@ -33,7 +33,7 @@ rhel8/ext4-ialloc-uid-gid-and-pass-owner-down.patch base/ext4-projid-xattrs.patch rhel8.5/ext4-enc-flag.patch rhel8/ext4-ext-merge.patch -base/ext4-delayed-iput.patch +rhel8.10/ext4-delayed-iput.patch rhel8/ext4-add-periodic-superblock-update.patch rhel8.7/ext4-filename-encode.patch rhel8/ext4-old_ea_inodes_handling_fix.patch diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 07c92fe..d495c4c 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -5,7 +5,7 @@ TBD Whamcloud * Server primary kernels built and tested during release cycle: 5.14.0-427.42.1.el9 (RHEL9.4) 5.14.0-362.24.1.el9 (RHEL9.3) - 4.18.0-553.16.1.el8 (RHEL8.10) + 4.18.0-553.27.1.el8 (RHEL8.10) 4.18.0-513.24.1.el8 (RHEL8.9) 4.18.0-477.27.1.el8 (RHEL8.8) * Other server kernels known to build and work at some point (others may also work): @@ -44,7 +44,7 @@ TBD Whamcloud * Client primary kernels built and tested during release cycle: 5.14.0-427.42.1.el9 (RHEL9.4) 5.14.0-362.24.1.el9 (RHEL9.3) - 4.18.0-553.16.1.el8 (RHEL8.10) + 4.18.0-553.27.1.el8 (RHEL8.10) 4.18.0-513.24.1.el8 (RHEL8.9) 4.18.0-477.27.1.el8 (RHEL8.8) 5.4.0-37 (Ubuntu 20.04) diff --git a/lustre/kernel_patches/targets/4.18-rhel8.10.target.in b/lustre/kernel_patches/targets/4.18-rhel8.10.target.in index cd42e6b..2952129 100644 --- a/lustre/kernel_patches/targets/4.18-rhel8.10.target.in +++ b/lustre/kernel_patches/targets/4.18-rhel8.10.target.in @@ -1,5 +1,5 @@ lnxmaj="4.18.0" -lnxrel="553.16.1.el8_10" +lnxrel="553.27.1.el8_10" KERNEL_SRPM=kernel-${lnxmaj}-${lnxrel}.src.rpm SERIES=4.18-rhel8.10.series diff --git a/lustre/kernel_patches/which_patch b/lustre/kernel_patches/which_patch index 037db16..c83bfce 100644 --- a/lustre/kernel_patches/which_patch +++ b/lustre/kernel_patches/which_patch @@ -20,7 +20,7 @@ PATCH SERIES FOR SERVER KERNELS: 4.18-rhel8.7.series 4.18.0-425.10.1.el8 (RHEL 8.7) 4.18-rhel8.8.series 4.18.0-477.27.1.el8 (RHEL 8.8) 4.18-rhel8.9.series 4.18.0-513.24.1.el8 (RHEL 8.9) -4.18-rhel8.10.series 4.18.0-553.16.1.el8 (RHEL 8.10) +4.18-rhel8.10.series 4.18.0-553.27.1.el8 (RHEL 8.10) 5.14-rhel9.1.series 5.14.0-162.23.1.el9 (RHEL 9.1) 5.14-rhel9.2.series 5.14.0-284.30.1.el9 (RHEL 9.2) 5.14-rhel9.3.series 5.14.0-362.24.1.el9 (RHEL 9.3) -- 1.8.3.1