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>
This commit is contained in:
Theodore Ts'o 2008-10-06 12:04:02 -04:00
Родитель ede86cc473
Коммит 45a90bfd90
1 изменённых файлов: 2 добавлений и 3 удалений

Просмотреть файл

@ -127,8 +127,7 @@ static int journal_submit_commit_record(journal_t *journal,
JBUFFER_TRACE(descriptor, "submit commit block"); JBUFFER_TRACE(descriptor, "submit commit block");
lock_buffer(bh); lock_buffer(bh);
get_bh(bh); clear_buffer_dirty(bh);
set_buffer_dirty(bh);
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
bh->b_end_io = journal_end_buffer_io_sync; 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 */ /* And try again, without the barrier */
lock_buffer(bh); lock_buffer(bh);
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
set_buffer_dirty(bh); clear_buffer_dirty(bh);
ret = submit_bh(WRITE, bh); ret = submit_bh(WRITE, bh);
} }
*cbh = bh; *cbh = bh;