]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: assert the folio is locked in folio_start_writeback()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 26 Feb 2025 15:36:12 +0000 (15:36 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 28 Feb 2025 01:00:36 +0000 (17:00 -0800)
The folio must be locked when we start writeback in order to prevent
writeback from being started twice on the same folio.  I don't expect this
to catch any problems, but it should be good documentation.

Link: https://lkml.kernel.org/r/20250226153614.3774896-1-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/page-writeback.c

index eb55ece39c565d72108856b784fd3524c83620c4..8b325aa525eb5d314b893ed97c8231e59e375233 100644 (file)
@@ -3109,6 +3109,7 @@ void __folio_start_writeback(struct folio *folio, bool keep_write)
        int access_ret;
 
        VM_BUG_ON_FOLIO(folio_test_writeback(folio), folio);
+       VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
 
        if (mapping && mapping_use_writeback_tags(mapping)) {
                XA_STATE(xas, &mapping->i_pages, folio_index(folio));