From: Theodore Ts'o Date: Sun, 16 Nov 2008 16:05:30 +0000 (-0500) Subject: jbd2: Fix buffer head leak when writing the commit block X-Git-Tag: v2.6.27.8~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=72966ac2446af2f7feeb7e773395cb17e9e8d325;p=thirdparty%2Fkernel%2Fstable.git jbd2: Fix buffer head leak when writing the commit block (cherry picked from commit 45a90bfd90c1215bf824c0f705b409723f52361b) Also make sure the buffer heads are marked clean before submitting bh for writing. The previous code was marking the buffer head dirty, which would have forced an unneeded write (and seek) to the journal for no good reason. Signed-off-by: "Theodore Ts'o" Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index f2ad061e95ec9..6caf22d7737d0 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -126,8 +126,7 @@ static int journal_submit_commit_record(journal_t *journal, JBUFFER_TRACE(descriptor, "submit commit block"); lock_buffer(bh); - get_bh(bh); - set_buffer_dirty(bh); + clear_buffer_dirty(bh); set_buffer_uptodate(bh); bh->b_end_io = journal_end_buffer_io_sync; @@ -160,7 +159,7 @@ static int journal_submit_commit_record(journal_t *journal, /* And try again, without the barrier */ lock_buffer(bh); set_buffer_uptodate(bh); - set_buffer_dirty(bh); + clear_buffer_dirty(bh); ret = submit_bh(WRITE, bh); } *cbh = bh;