summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2008-10-06 12:04:02 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-10-06 12:04:02 -0400
commit45a90bfd90c1215bf824c0f705b409723f52361b (patch)
treee314c36e14c380b87d19e3054494768f4c14e458
parentede86cc473defab74d778aeac14b19f43129d4d1 (diff)
downloadlwn-45a90bfd90c1215bf824c0f705b409723f52361b.tar.gz
lwn-45a90bfd90c1215bf824c0f705b409723f52361b.zip
jbd2: Fix buffer head leak when writing the commit block
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" <tytso@mit.edu>
-rw-r--r--fs/jbd2/commit.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index e91f051a9859..0d3814a35ed1 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -127,8 +127,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;
@@ -158,7 +157,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;