diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-06-18 10:52:23 -0400 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-07-04 21:44:20 -0400 |
commit | 8227b29722fdbac72357aae155d171a5c777670c (patch) | |
tree | d44631f3aac26da4cdcd2abd8b0f1d8661fc59b5 /fs | |
parent | 0cfae3d8795f388f9de78adb0171520d19da77e9 (diff) |
nilfs2: fix hang problem of log writer which occurs after write failures
Leandro Lucarella gave me a report that nilfs gets stuck after its
write function fails.
The problem turned out to be caused by bugs which leave writeback flag
on pages. This fixes the problem by ensuring to clear the writeback
flag in error path.
Reported-by: Leandro Lucarella <llucax@gmail.com>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: stable@kernel.org
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nilfs2/segment.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index c1824915c1c7..8b5e4778cf28 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -1836,19 +1836,6 @@ static int nilfs_segctor_write(struct nilfs_sc_info *sci, | |||
1836 | return 0; | 1836 | return 0; |
1837 | } | 1837 | } |
1838 | 1838 | ||
1839 | static int nilfs_page_has_uncleared_buffer(struct page *page) | ||
1840 | { | ||
1841 | struct buffer_head *head, *bh; | ||
1842 | |||
1843 | head = bh = page_buffers(page); | ||
1844 | do { | ||
1845 | if (buffer_dirty(bh) && !list_empty(&bh->b_assoc_buffers)) | ||
1846 | return 1; | ||
1847 | bh = bh->b_this_page; | ||
1848 | } while (bh != head); | ||
1849 | return 0; | ||
1850 | } | ||
1851 | |||
1852 | static void __nilfs_end_page_io(struct page *page, int err) | 1839 | static void __nilfs_end_page_io(struct page *page, int err) |
1853 | { | 1840 | { |
1854 | if (!err) { | 1841 | if (!err) { |
@@ -1872,12 +1859,11 @@ static void nilfs_end_page_io(struct page *page, int err) | |||
1872 | if (!page) | 1859 | if (!page) |
1873 | return; | 1860 | return; |
1874 | 1861 | ||
1875 | if (buffer_nilfs_node(page_buffers(page)) && | 1862 | if (buffer_nilfs_node(page_buffers(page)) && !PageWriteback(page)) |
1876 | nilfs_page_has_uncleared_buffer(page)) | 1863 | /* |
1877 | /* For b-tree node pages, this function may be called twice | 1864 | * For b-tree node pages, this function may be called twice |
1878 | or more because they might be split in a segment. | 1865 | * or more because they might be split in a segment. |
1879 | This check assures that cleanup has been done for all | 1866 | */ |
1880 | buffers in a split btnode page. */ | ||
1881 | return; | 1867 | return; |
1882 | 1868 | ||
1883 | __nilfs_end_page_io(page, err); | 1869 | __nilfs_end_page_io(page, err); |
@@ -1940,7 +1926,7 @@ static void nilfs_segctor_abort_write(struct nilfs_sc_info *sci, | |||
1940 | } | 1926 | } |
1941 | if (bh->b_page != fs_page) { | 1927 | if (bh->b_page != fs_page) { |
1942 | nilfs_end_page_io(fs_page, err); | 1928 | nilfs_end_page_io(fs_page, err); |
1943 | if (unlikely(fs_page == failed_page)) | 1929 | if (fs_page && fs_page == failed_page) |
1944 | goto done; | 1930 | goto done; |
1945 | fs_page = bh->b_page; | 1931 | fs_page = bh->b_page; |
1946 | } | 1932 | } |