FAILED: patch "[PATCH] f2fs: return writeback error from collapse range" failed to apply to 5.10-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x f8a4108800254d6f7b2755515fbbd9d0caac561e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090921-luncheon-anywhere-f22e@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From f8a4108800254d6f7b2755515fbbd9d0caac561e Mon Sep 17 00:00:00 2001
From: Wenjie Qi <[email protected]>
Date: Mon, 27 Jul 2026 15:49:10 +0800
Subject: [PATCH] f2fs: return writeback error from collapse range
f2fs_collapse_range() writes back pages moved by f2fs_do_collapse(), but ignores the return value. If writeback fails, the ioctl can still truncate page cache, shrink blocks, and report success.
Return the error before truncating page cache or updating the file size.
fs/f2fs/file.c +4 -1
@@ -1623,11 +1623,14 @@ static int f2fs_collapse_range(struct inode *inode, loff_t offset, loff_t len)/* write out all moved pages, if possible */ filemap_invalidate_lock (inode->i_mapping); -filemap_write_and_wait_range (inode->i_mapping, offset,LLONG_MAX ); + ret =filemap_write_and_wait_range (inode->i_mapping, offset,LLONG_MAX ); +if (ret) + goto out_unlock;truncate_pagecache (inode, offset); new_size =i_size_read (inode) - len; ret =f2fs_truncate_blocks (inode, new_size, true); +out_unlock:filemap_invalidate_unlock (inode->i_mapping);if (!ret)f2fs_i_size_write (inode, new_size);
Sasha Levin
maintainerPATCH 1/1 f2fs: return writeback error from collapse range
From: Wenjie Qi <[email protected]>
[ Upstream commit f8a4108800254d6f7b2755515fbbd9d0caac561e ]
f2fs_collapse_range() writes back pages moved by f2fs_do_collapse(), but ignores the return value. If writeback fails, the ioctl can still truncate page cache, shrink blocks, and report success.
Return the error before truncating page cache or updating the file size.
--- fs/f2fs/file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/f2fs/file.c +4 -1
@@ -1402,11 +1402,14 @@ static int f2fs_collapse_range(struct inode *inode, loff_t offset, loff_t len)/* write out all moved pages, if possible */ down_write (&F2FS_I (inode)->i_mmap_sem); -filemap_write_and_wait_range (inode->i_mapping, offset,LLONG_MAX ); + ret =filemap_write_and_wait_range (inode->i_mapping, offset,LLONG_MAX ); +if (ret) + goto out_unlock;truncate_pagecache (inode, offset); new_size =i_size_read (inode) - len; ret =f2fs_truncate_blocks (inode, new_size, true); +out_unlock:up_write (&F2FS_I (inode)->i_mmap_sem);if (!ret)f2fs_i_size_write (inode, new_size);
Signature · 1 line
2.53.0