提交 ffda9d30 编写于 作者: N Nick Piggin 提交者: Linus Torvalds

[PATCH] fs: fix __block_write_full_page error case buffer submission

Andrew noticed that unlocking the page before submitting all buffers for
writeout could cause problems if the IO completes before we've finished
messing around with the page buffers, and they subsequently get freed.

Even if there were no bug, it is a good idea to bring the error case
into line with the common case here.
Signed-off-by: NNick Piggin <npiggin@suse.de>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 bc56bba8
......@@ -1743,7 +1743,6 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
SetPageError(page);
BUG_ON(PageWriteback(page));
set_page_writeback(page);
unlock_page(page);
do {
struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) {
......@@ -1753,6 +1752,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
}
bh = next;
} while (bh != head);
unlock_page(page);
goto done;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册