diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2025-02-26 15:36:12 +0000 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2025-03-17 00:05:29 -0700 |
commit | 173a3dc051bda746e284ff3933fcf6771d7247b8 (patch) | |
tree | 1a430442e485c280b1646cc0d7b803a75ef940e3 | |
parent | a58f3dcf20ea9e7e968ee8369fd782bbb53dff73 (diff) |
mm: assert the folio is locked in folio_start_writeback()
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>
-rw-r--r-- | mm/page-writeback.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index eb55ece39c56..8b325aa525eb 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -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)); |