[SRU][mantic][PATCH 1/1] UBUNTU: SAUCE: Revert "cifs: fix flushing folio regression for 6.1 backport"

Matthew Ruffell matthew.ruffell at canonical.com
Mon Apr 22 02:30:27 UTC 2024


BugLink: https://bugs.launchpad.net/bugs/2060919

This reverts commit 21bb2ba4f1ac1e3a57594be62dd74e7b1401b2b1 (ubuntu-mantic).

__filemap_get_folio() works differently in 6.1.y where the patch was initially
sourced from, to mantic's 6.5 kernel. In 6.1.y, it returns a folio or NULL,
and in 6.5, it returns a folio or negative error code.

With this applied to mantic's 6.5, users would see page faults when attempting
to copy or write to a file from the same directory as the source.

BUG: unable to handle page fault for address: fffffffffffffffe
...
RIP: 0010:cifs_flush_folio+0x41/0xf0 [cifs]
...
Call Trace:
<TASK>
? show_regs+0x6d/0x80
? __die+0x24/0x80
? page_fault_oops+0x99/0x1b0
? kernelmode_fixup_or_oops+0xb2/0x140
? __bad_area_nosemaphore+0x1a5/0x2c0
? bad_area_nosemaphore+0x16/0x30
? do_kern_addr_fault+0x7b/0xa0
? exc_page_fault+0x1a4/0x1b0
? asm_exc_page_fault+0x27/0x30
? cifs_flush_folio+0x41/0xf0 [cifs]
? cifs_flush_folio+0x37/0xf0 [cifs]
cifs_remap_file_range+0x172/0x660 [cifs]
do_clone_file_range+0x101/0x2d0
vfs_clone_file_range+0x3f/0x150
ioctl_file_clone+0x52/0xc0
do_vfs_ioctl+0x68f/0x910
...

"cifs: fix flushing folio regression for 6.1 backport" should have never been
applied to mantic's tree, thus we revert it as a SAUCE patch.

Signed-off-by: Matthew Ruffell <matthew.ruffell at canonical.com>
---
 fs/smb/client/cifsfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
index 55a6d0296ec8..82313b253463 100644
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -1245,7 +1245,7 @@ static int cifs_flush_folio(struct inode *inode, loff_t pos, loff_t *_fstart, lo
 	int rc = 0;
 
 	folio = filemap_get_folio(inode->i_mapping, index);
-	if (!folio)
+	if (IS_ERR(folio))
 		return 0;
 
 	size = folio_size(folio);
-- 
2.40.1




More information about the kernel-team mailing list