Skip to content

Commit

Permalink
[PATCH] fs: fix __block_write_full_page error case buffer submission
Browse files Browse the repository at this point in the history
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 <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Feb 21, 2007
1 parent bc56bba commit ffda9d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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;
}

Expand Down

0 comments on commit ffda9d3

Please sign in to comment.