Skip to content

Commit

Permalink
jbd2: Fix buffer head leak when writing the commit block
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
tytso committed Oct 6, 2008
1 parent ede86cc commit 45a90bf
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions fs/jbd2/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 45a90bf

Please sign in to comment.