[Devel] [PATCH RHEL8 COMMIT] fs: avoid writeback busy-loop if redirty

Konstantin Khorenko khorenko at virtuozzo.com
Fri Apr 16 14:27:17 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.14
------>
commit 57da42f338e8152e8bca281c3bbf12f8107ddce6
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date:   Fri Apr 16 14:27:16 2021 +0300

    fs: avoid writeback busy-loop if redirty
    
    wb_writeback() bails out only if either nr_pages comes to zero or
    "progress" (as reported by writeback_sb_inodes or __writeback_inodes_wb)
    is zero.
    
    If a page is temporarily unavailable (is under fuse-writeback),
    fuse_writepages_fill calls redirty_page_for_writepage, unlock the page
    and returns OK. This OK results in progress=1. So wb_writeback
    loops over writeback_sb_inodes/__writeback_inodes_wb again and again
    until all nr_pages are exhausted.
    
    The patch ensures that progress=0 if fuse_writepages_fill did nothing.
    
    Might be in charge of https://jira.sw.ru/browse/PSBM-55919
    
    Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
    
    khorenko@: s/BUG_ON/WARN_ON/
    If we face this warn_on, we enable "kernel.panic_on_warn" on
    nodes which trigger it.
    
    +++
    
    send to MS?
    
    VZ 8 rebase part https://jira.sw.ru/browse/PSBM-127782
    vz7 commit: 7628501 ("fs: avoid writeback busy-loop if redirty")
    
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
---
 fs/fs-writeback.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 226a030d4a10..4bc064e21675 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1674,6 +1674,9 @@ static long writeback_sb_inodes(struct super_block *sb,
 			if (work->nr_pages <= 0)
 				break;
 		}
+
+		WARN_ON(wbc.pages_skipped > write_chunk - wbc.nr_to_write);
+		wrote -= wbc.pages_skipped;
 	}
 	return wrote;
 }


More information about the Devel mailing list