Commit 5bc09b3
nilfs2: fix potential bug in end_buffer_async_write
According to a syzbot report, end_buffer_async_write(), which handles the
completion of block device writes, may detect abnormal condition of the
buffer async_write flag and cause a BUG_ON failure when using nilfs2.
Nilfs2 itself does not use end_buffer_async_write(). But, the async_write
flag is now used as a marker by commit 7f42ec3 ("nilfs2: fix issue
with race condition of competition between segments for dirty blocks") as
a means of resolving double list insertion of dirty blocks in
nilfs_lookup_dirty_data_buffers() and nilfs_lookup_node_buffers() and the
resulting crash.
This modification is safe as long as it is used for file data and b-tree
node blocks where the page caches are independent. However, it was
irrelevant and redundant to also introduce async_write for segment summary
and super root blocks that share buffers with the backing device. This
led to the possibility that the BUG_ON check in end_buffer_async_write
would fail as described above, if independent writebacks of the backing
device occurred in parallel.
The use of async_write for segment summary buffers has already been
removed in a previous change.
Fix this issue by removing the manipulation of the async_write flag for
the remaining super root block buffer.
Link: https://lkml.kernel.org/r/20240203161645.4992-1-konishi.ryusuke@gmail.com
Fixes: 7f42ec3 ("nilfs2: fix issue with race condition of competition between segments for dirty blocks")
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Reported-by: syzbot+5c04210f7c7f897c1e7f@syzkaller.appspotmail.com
Closes: https://lkml.kernel.org/r/00000000000019a97c05fd42f8c8@google.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent b9e4bc1 commit 5bc09b3
1 file changed
+5
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1703 | 1703 | | |
1704 | 1704 | | |
1705 | 1705 | | |
1706 | | - | |
1707 | 1706 | | |
1708 | 1707 | | |
1709 | 1708 | | |
| |||
1714 | 1713 | | |
1715 | 1714 | | |
1716 | 1715 | | |
| 1716 | + | |
1717 | 1717 | | |
1718 | 1718 | | |
1719 | 1719 | | |
| |||
1800 | 1800 | | |
1801 | 1801 | | |
1802 | 1802 | | |
1803 | | - | |
1804 | 1803 | | |
1805 | 1804 | | |
1806 | 1805 | | |
| |||
1809 | 1808 | | |
1810 | 1809 | | |
1811 | 1810 | | |
| 1811 | + | |
1812 | 1812 | | |
1813 | 1813 | | |
1814 | 1814 | | |
| |||
1896 | 1896 | | |
1897 | 1897 | | |
1898 | 1898 | | |
1899 | | - | |
1900 | 1899 | | |
| 1900 | + | |
| 1901 | + | |
1901 | 1902 | | |
1902 | 1903 | | |
1903 | 1904 | | |
1904 | 1905 | | |
1905 | 1906 | | |
1906 | 1907 | | |
1907 | 1908 | | |
| 1909 | + | |
1908 | 1910 | | |
1909 | 1911 | | |
1910 | 1912 | | |
| |||
0 commit comments