[Devel] [PATCH RHEL10 COMMIT] fs/fuse: redirty folio on -ENOMEM in fuse_writepages_fill()
Konstantin Khorenko
khorenko at virtuozzo.com
Fri May 15 18:17:31 MSK 2026
The commit is pushed to "branch-rh10-6.12.0-55.52.1.5.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-55.52.1.5.25.vz10
------>
commit f187c7d1e5c5fc46e4bd274667afc729cb10c8ca
Author: Liu Kui <kui.liu at virtuozzo.com>
Date: Mon Apr 20 15:13:03 2026 +0800
fs/fuse: redirty folio on -ENOMEM in fuse_writepages_fill()
When fuse_writepages_fill() fails with -ENOMEM (folio or writepage args
allocation), the folio has already been cleaned by clear_page_dirty_for_io()
in write_cache_pages() but was never written back. Without redirtying,
the folio is left in a clean state with its data silently lost - the VFS
considers it clean and will not retry writeback.
Add folio_redirty_for_writepage() in both ENOMEM paths so the VFS can
retry the writeback later when memory pressure subsides.
Signed-off-by: Liu Kui <kui.liu at virtuozzo.com>
Acked-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
Feature: vStorage
---
fs/fuse/file.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index b84aac13bfc91..edea59ee4839a 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2724,13 +2724,11 @@ static int fuse_writepages_fill(struct folio *folio,
int err;
int check_for_blocked = 0;
- if (!wpa && test_bit(FUSE_I_INVAL_FILES, &fi->state)) {
- unlock_page(&folio->page);
- return -EIO;
- }
+ err = -EIO;
+ if (unlikely(!wpa && test_bit(FUSE_I_INVAL_FILES, &fi->state)))
+ goto out_unlock;
if (!data->ff) {
- err = -EIO;
data->ff = fuse_write_file_get(fi);
if (!data->ff)
goto out_unlock;
@@ -2743,8 +2741,10 @@ static int fuse_writepages_fill(struct folio *folio,
err = -ENOMEM;
tmp_folio = folio_alloc(GFP_NOFS | __GFP_HIGHMEM, 0);
- if (!tmp_folio)
+ if (!tmp_folio) {
+ folio_redirty_for_writepage(wbc, folio);
goto out_unlock;
+ }
/*
* The page must not be redirtied until the writeout is completed
@@ -2764,6 +2764,7 @@ static int fuse_writepages_fill(struct folio *folio,
wpa = fuse_writepage_args_setup(folio, data->ff);
if (!wpa) {
folio_put(tmp_folio);
+ folio_redirty_for_writepage(wbc, folio);
goto out_unlock;
}
fuse_file_get(wpa->ia.ff);
More information about the Devel
mailing list