]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] fs: fix __block_write_full_page error case buffer submission
authorNick Piggin <npiggin@suse.de>
Tue, 20 Feb 2007 21:57:54 +0000 (13:57 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 21 Feb 2007 01:10:13 +0000 (17:10 -0800)
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>
fs/buffer.c

index f99c509697cd7b11865b6d40f8abda1bd349d7a1..e95fe4f8d11a69eccba7efb818d02f4f0af64288 100644 (file)
@@ -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;
 }