]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: fix assertion in folio_end_read()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 10 Jan 2025 16:32:57 +0000 (16:32 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 13 Jan 2025 03:03:38 +0000 (19:03 -0800)
We only need to assert that the uptodate flag is clear if we're going to
set it.  This hasn't been a problem before now because we have only used
folio_end_read() when completing with an error, but it's convenient to use
it in squashfs if we discover the folio is already uptodate.

Link: https://lkml.kernel.org/r/20250110163300.3346321-1-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Phillip Lougher <phillip@squashfs.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/filemap.c

index 118fa1e0bafe8ba46a13080c7b72f4407c0cdfcf..4f476411a9a2dadf6b24f1852eda2e2d429a9df9 100644 (file)
@@ -1523,7 +1523,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;