linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] fs: fix __block_write_full_page error case buffer submission
@ 2007-02-06  8:33 Nick Piggin
  0 siblings, 0 replies; only message in thread
From: Nick Piggin @ 2007-02-06  8:33 UTC (permalink / raw)
  To: Linux Kernel Mailing List, Andrew Morton

OK, I had initially been going to send a patch to bring the common case
into line with the error case to reduce the chance of rare bugs, but
that's stupid because the common case is obviously the better tested one!

Oh, and the error case seems to have a bug as well.

--
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>

Index: linux-2.6/fs/buffer.c
===================================================================
--- linux-2.6.orig/fs/buffer.c
+++ linux-2.6/fs/buffer.c
@@ -1732,7 +1732,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)) {
@@ -1742,6 +1741,7 @@ recover:
 		}
 		bh = next;
 	} while (bh != head);
+	unlock_page(page);
 	goto done;
 }
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-02-06  8:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-06  8:33 [patch] fs: fix __block_write_full_page error case buffer submission Nick Piggin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).