Commit 7ae0eef7 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix JBD memory leak

Plug the two-megabyte-per-day memory leak.
parent 9aa379e8
......@@ -172,6 +172,14 @@ void journal_commit_transaction(journal_t *journal)
while (commit_transaction->t_reserved_list) {
jh = commit_transaction->t_reserved_list;
JBUFFER_TRACE(jh, "reserved, unused: refile");
/*
* A journal_get_undo_access()+journal_release_buffer() may
* leave undo-committed data.
*/
if (jh->b_committed_data) {
kfree(jh->b_committed_data);
jh->b_committed_data = NULL;
}
journal_refile_buffer(journal, jh);
}
......
......@@ -1729,6 +1729,8 @@ static void __journal_remove_journal_head(struct buffer_head *bh)
J_ASSERT_BH(bh, buffer_jbd(bh));
J_ASSERT_BH(bh, jh2bh(jh) == bh);
BUFFER_TRACE(bh, "remove journal_head");
J_ASSERT_BH(bh, !jh->b_frozen_data);
J_ASSERT_BH(bh, !jh->b_committed_data);
bh->b_private = NULL;
jh->b_bh = NULL; /* debug, really */
clear_buffer_jbd(bh);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment