public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Ryan Roberts <ryan.roberts@arm.com>
Cc: Phillip Lougher <phillip@squashfs.org.uk>,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2 5/5] squashfs: Convert squashfs_fill_page() to take a folio
Date: Fri, 10 Jan 2025 02:05:20 +0000	[thread overview]
Message-ID: <Z4CAYCSJaF2dmJwj@casper.infradead.org> (raw)
In-Reply-To: <269c495b-e0f4-4c0c-aaf4-0e49823276d1@arm.com>

On Thu, Jan 09, 2025 at 05:34:43PM +0000, Ryan Roberts wrote:
> I started getting a different oops after I fixed this issue. It turns out that
> __filemap_get_folio() returns ERR_PTR() on error whereas
> grab_cache_page_nowait() (used previously) returns NULL. So the continue
> condition needs to change. This fixes both for me:

Hey Ryan, can you try this amalgam of three patches?
If it works out, I'll send the two which aren't yet in akpm's tree to
him.

diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c
index da25d6fa45ce..5ca2baa16dc2 100644
--- a/fs/squashfs/file.c
+++ b/fs/squashfs/file.c
@@ -400,7 +400,7 @@ void squashfs_copy_cache(struct folio *folio,
 			bytes -= PAGE_SIZE, offset += PAGE_SIZE) {
 		struct folio *push_folio;
 		size_t avail = buffer ? min(bytes, PAGE_SIZE) : 0;
-		bool uptodate = true;
+		bool updated = false;
 
 		TRACE("bytes %zu, i %d, available_bytes %zu\n", bytes, i, avail);
 
@@ -409,15 +409,15 @@ void squashfs_copy_cache(struct folio *folio,
 					FGP_LOCK|FGP_CREAT|FGP_NOFS|FGP_NOWAIT,
 					mapping_gfp_mask(mapping));
 
-		if (!push_folio)
+		if (IS_ERR(push_folio))
 			continue;
 
 		if (folio_test_uptodate(push_folio))
 			goto skip_folio;
 
-		uptodate = squashfs_fill_page(push_folio, buffer, offset, avail);
+		updated = squashfs_fill_page(push_folio, buffer, offset, avail);
 skip_folio:
-		folio_end_read(push_folio, uptodate);
+		folio_end_read(push_folio, updated);
 		if (i != folio->index)
 			folio_put(push_folio);
 	}
diff --git a/mm/filemap.c b/mm/filemap.c
index 12ba297bb85e..3b1eefa9aab8 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1505,7 +1505,7 @@ void folio_end_read(struct folio *folio, bool success)
 	/* Must be in bottom byte for x86 to work */
 	BUILD_BUG_ON(PG_uptodate > 7);
 	VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
-	VM_BUG_ON_FOLIO(folio_test_uptodate(folio), folio);
+	VM_BUG_ON_FOLIO(success && folio_test_uptodate(folio), folio);
 
 	if (likely(success))
 		mask |= 1 << PG_uptodate;

  reply	other threads:[~2025-01-10  2:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-20 22:46 [PATCH v2 1/5] squashfs: Use a folio throughout squashfs_read_folio() Matthew Wilcox (Oracle)
2024-12-20 22:46 ` [PATCH v2 2/5] squashfs: Pass a folio to squashfs_readpage_fragment() Matthew Wilcox (Oracle)
2025-01-14 21:11   ` Phillip Lougher
2024-12-20 22:46 ` [PATCH v2 3/5] squashfs: Convert squashfs_readpage_block() to take a folio Matthew Wilcox (Oracle)
2025-01-14 21:11   ` Phillip Lougher
2024-12-20 22:46 ` [PATCH v2 4/5] squashfs; Convert squashfs_copy_cache() " Matthew Wilcox (Oracle)
2025-01-14 21:12   ` Phillip Lougher
2024-12-20 22:46 ` [PATCH v2 5/5] squashfs: Convert squashfs_fill_page() " Matthew Wilcox (Oracle)
2024-12-30  0:45   ` Phillip Lougher
2025-01-09 15:22     ` Ryan Roberts
2025-01-09 15:24       ` Ryan Roberts
2025-01-09 17:34         ` Ryan Roberts
2025-01-10  2:05           ` Matthew Wilcox [this message]
2025-01-10  9:46             ` Ryan Roberts
2025-01-14 21:12   ` Phillip Lougher
2025-01-14 21:11 ` [PATCH v2 1/5] squashfs: Use a folio throughout squashfs_read_folio() Phillip Lougher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z4CAYCSJaF2dmJwj@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=phillip@squashfs.org.uk \
    --cc=ryan.roberts@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox