--- /dev/null
+From ba288a873fb8ac3d1bf5563366558a905620c071 Mon Sep 17 00:00:00 2001
+From: Steve French <stfrench@microsoft.com>
+Date: Fri, 12 Jan 2024 23:08:51 -0600
+Subject: cifs: fix flushing folio regression for 6.1 backport
+
+filemap_get_folio works differenty in 6.1 vs. later kernels
+(returning NULL in 6.1 instead of an error). Add
+this minor correction which addresses the regression in the patch:
+ cifs: Fix flushing, invalidation and file size with copy_file_range()
+
+Suggested-by: David Howells <dhowells@redhat.com>
+Reported-by: Salvatore Bonaccorso <carnil@debian.org>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/smb/client/cifsfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/smb/client/cifsfs.c
++++ b/fs/smb/client/cifsfs.c
+@@ -1240,7 +1240,7 @@ static int cifs_flush_folio(struct inode
+ int rc = 0;
+
+ folio = filemap_get_folio(inode->i_mapping, index);
+- if (IS_ERR(folio))
++ if ((!folio) || (IS_ERR(folio)))
+ return 0;
+
+ size = folio_size(folio);