diff options
author | Theodore Ts'o <tytso@mit.edu> | 2008-10-06 12:04:02 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-10-06 12:04:02 -0400 |
commit | 45a90bfd90c1215bf824c0f705b409723f52361b (patch) | |
tree | e314c36e14c380b87d19e3054494768f4c14e458 /fs | |
parent | ede86cc473defab74d778aeac14b19f43129d4d1 (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/jbd2/commit.c | 5 |
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, | |||
127 | 127 | ||
128 | JBUFFER_TRACE(descriptor, "submit commit block"); | 128 | JBUFFER_TRACE(descriptor, "submit commit block"); |
129 | lock_buffer(bh); | 129 | lock_buffer(bh); |
130 | get_bh(bh); | 130 | clear_buffer_dirty(bh); |
131 | set_buffer_dirty(bh); | ||
132 | set_buffer_uptodate(bh); | 131 | set_buffer_uptodate(bh); |
133 | bh->b_end_io = journal_end_buffer_io_sync; | 132 | bh->b_end_io = journal_end_buffer_io_sync; |
134 | 133 | ||
@@ -158,7 +157,7 @@ static int journal_submit_commit_record(journal_t *journal, | |||
158 | /* And try again, without the barrier */ | 157 | /* And try again, without the barrier */ |
159 | lock_buffer(bh); | 158 | lock_buffer(bh); |
160 | set_buffer_uptodate(bh); | 159 | set_buffer_uptodate(bh); |
161 | set_buffer_dirty(bh); | 160 | clear_buffer_dirty(bh); |
162 | ret = submit_bh(WRITE, bh); | 161 | ret = submit_bh(WRITE, bh); |
163 | } | 162 | } |
164 | *cbh = bh; | 163 | *cbh = bh; |