From: Nick Piggin Date: Tue, 20 Feb 2007 21:57:54 +0000 (-0800) Subject: [PATCH] fs: fix __block_write_full_page error case buffer submission X-Git-Tag: v2.6.21-rc1~39 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=ffda9d302267dbb7fc9bc38f6e4c1b3d61a536a9;p=linux-2.6-omap-h63xx.git [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: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/buffer.c b/fs/buffer.c index f99c509697c..e95fe4f8d11 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1743,7 +1743,6 @@ recover: 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 @@ recover: } bh = next; } while (bh != head); + unlock_page(page); goto done; }