From 912ab715365e8d43c96cec9bd1a6df508659f3bc Mon Sep 17 00:00:00 2001 From: Li Dongyang Date: Mon, 6 Nov 2023 15:22:47 +1100 Subject: [PATCH] LU-17248 kernel: wait for pages under writeback for bdev Use a better version of kernel patch instead of just adding SB_I_STABLE_WRITES flag to bdev superblock. We don't need to wait for page writeback for all block devices, even for those don't require stable_page. Test-Parameters: trivial Fixes: 5968bc3954 ("LU-17248 kernel: add SB_I_STABLE_WRITES to bdev sb flag") Signed-off-by: Li Dongyang Change-Id: I20cfa33c4ef45b10e6a732e325698c6b1b00bc79 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53001 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo --- ...dd-SB_I_STABLE_WRITES-to-bdev-sb-flag-rhel8.6.patch | 13 ------------- ...for_stable_page-should-check-for-bdev-rhel8.6.patch | 18 ++++++++++++++++++ lustre/kernel_patches/series/4.18-rhel8.6.series | 2 +- lustre/kernel_patches/series/4.18-rhel8.7.series | 2 +- lustre/kernel_patches/series/4.18-rhel8.8.series | 2 +- 5 files changed, 21 insertions(+), 16 deletions(-) delete mode 100644 lustre/kernel_patches/patches/block-add-SB_I_STABLE_WRITES-to-bdev-sb-flag-rhel8.6.patch create mode 100644 lustre/kernel_patches/patches/mm-wait_for_stable_page-should-check-for-bdev-rhel8.6.patch diff --git a/lustre/kernel_patches/patches/block-add-SB_I_STABLE_WRITES-to-bdev-sb-flag-rhel8.6.patch b/lustre/kernel_patches/patches/block-add-SB_I_STABLE_WRITES-to-bdev-sb-flag-rhel8.6.patch deleted file mode 100644 index 6c4a32c..0000000 --- a/lustre/kernel_patches/patches/block-add-SB_I_STABLE_WRITES-to-bdev-sb-flag-rhel8.6.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: linux-4.18.0-372.32.1.el8_6/fs/block_dev.c -=================================================================== ---- linux-4.18.0-372.32.1.el8_6.orig/fs/block_dev.c -+++ linux-4.18.0-372.32.1.el8_6/fs/block_dev.c -@@ -888,7 +888,7 @@ static int bd_init_fs_context(struct fs_ - struct pseudo_fs_context *ctx = init_pseudo(fc, BDEVFS_MAGIC); - if (!ctx) - return -ENOMEM; -- fc->s_iflags |= SB_I_CGROUPWB; -+ fc->s_iflags |= SB_I_CGROUPWB | SB_I_STABLE_WRITES; - ctx->ops = &bdev_sops; - return 0; - } diff --git a/lustre/kernel_patches/patches/mm-wait_for_stable_page-should-check-for-bdev-rhel8.6.patch b/lustre/kernel_patches/patches/mm-wait_for_stable_page-should-check-for-bdev-rhel8.6.patch new file mode 100644 index 0000000..9b03738 --- /dev/null +++ b/lustre/kernel_patches/patches/mm-wait_for_stable_page-should-check-for-bdev-rhel8.6.patch @@ -0,0 +1,18 @@ +Index: linux-4.18.0-372.32.1.el8_6/mm/page-writeback.c +=================================================================== +--- linux-4.18.0-372.32.1.el8_6.orig/mm/page-writeback.c ++++ linux-4.18.0-372.32.1.el8_6/mm/page-writeback.c +@@ -2894,7 +2894,12 @@ EXPORT_SYMBOL_GPL(wait_on_page_writeback + */ + void wait_for_stable_page(struct page *page) + { +- if (page->mapping->host->i_sb->s_iflags & SB_I_STABLE_WRITES) ++ struct inode *inode = page->mapping->host; ++ struct super_block *sb = inode->i_sb; ++ ++ if ((sb->s_iflags & SB_I_STABLE_WRITES) || ++ (sb_is_blkdev_sb(sb) && ++ blk_queue_stable_writes(I_BDEV(inode)->bd_disk->queue))) + wait_on_page_writeback(page); + } + EXPORT_SYMBOL_GPL(wait_for_stable_page); diff --git a/lustre/kernel_patches/series/4.18-rhel8.6.series b/lustre/kernel_patches/series/4.18-rhel8.6.series index 8c3600c..5c851fa 100644 --- a/lustre/kernel_patches/series/4.18-rhel8.6.series +++ b/lustre/kernel_patches/series/4.18-rhel8.6.series @@ -5,4 +5,4 @@ block-integrity-allow-optional-integrity-functions-rhel8.3.patch block-pass-bio-into-integrity_processing_fn-rhel8.patch scsi-requeue-aborted-commands-instead-of-retry-rhel8.patch snapshot-jbd2-rhel8.3.patch -block-add-SB_I_STABLE_WRITES-to-bdev-sb-flag-rhel8.6.patch +mm-wait_for_stable_page-should-check-for-bdev-rhel8.6.patch diff --git a/lustre/kernel_patches/series/4.18-rhel8.7.series b/lustre/kernel_patches/series/4.18-rhel8.7.series index 9d08ccc..2cc8b62 100644 --- a/lustre/kernel_patches/series/4.18-rhel8.7.series +++ b/lustre/kernel_patches/series/4.18-rhel8.7.series @@ -4,4 +4,4 @@ block-integrity-allow-optional-integrity-functions-rhel8.3.patch block-pass-bio-into-integrity_processing_fn-rhel8.patch scsi-requeue-aborted-commands-instead-of-retry-rhel8.patch snapshot-jbd2-rhel8.3.patch -block-add-SB_I_STABLE_WRITES-to-bdev-sb-flag-rhel8.6.patch +mm-wait_for_stable_page-should-check-for-bdev-rhel8.6.patch diff --git a/lustre/kernel_patches/series/4.18-rhel8.8.series b/lustre/kernel_patches/series/4.18-rhel8.8.series index 9d08ccc..2cc8b62 100644 --- a/lustre/kernel_patches/series/4.18-rhel8.8.series +++ b/lustre/kernel_patches/series/4.18-rhel8.8.series @@ -4,4 +4,4 @@ block-integrity-allow-optional-integrity-functions-rhel8.3.patch block-pass-bio-into-integrity_processing_fn-rhel8.patch scsi-requeue-aborted-commands-instead-of-retry-rhel8.patch snapshot-jbd2-rhel8.3.patch -block-add-SB_I_STABLE_WRITES-to-bdev-sb-flag-rhel8.6.patch +mm-wait_for_stable_page-should-check-for-bdev-rhel8.6.patch -- 1.8.3.1