Skip to content

Commit bd15939

Browse files
jankaratytso
authored andcommitted
jdb2: Don't refuse invalidation of already invalidated buffers
When invalidating buffers under the partial tail page, jbd2_journal_invalidate_folio() returns -EBUSY if the buffer is part of the committing transaction as we cannot safely modify buffer state. However if the buffer is already invalidated (due to previous invalidation attempts from ext4_wait_for_tail_page_commit()), there's nothing to do and there's no point in returning -EBUSY. This fixes occasional warnings from ext4_journalled_invalidate_folio() triggered by generic/051 fstest when blocksize < pagesize. Fixes: 53e8726 ("ext4: fix deadlock in journal_unmap_buffer()") Signed-off-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent e9ebecf commit bd15939

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/jbd2/transaction.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2387,6 +2387,9 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh,
23872387
spin_unlock(&jh->b_state_lock);
23882388
write_unlock(&journal->j_state_lock);
23892389
jbd2_journal_put_journal_head(jh);
2390+
/* Already zapped buffer? Nothing to do... */
2391+
if (!bh->b_bdev)
2392+
return 0;
23902393
return -EBUSY;
23912394
}
23922395
/*

0 commit comments

Comments
 (0)