]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
jbd: fix possible journal overflow issues
authorJosef Bacik <jbacik@redhat.com>
Mon, 28 Apr 2008 09:16:12 +0000 (02:16 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 6 Aug 2008 17:10:59 +0000 (10:10 -0700)
commit66f2a73adbb5d81bebd1b8acb23b9db43640f5d4
tree09de9a1a8920ca9c019ac769f00ff021c76ec019
parent53f501a19fc08631458f228b5ad2bdc46d65846b
jbd: fix possible journal overflow issues

commit 5b9a499d77e9dd39c9e6611ea10c56a31604f274 upstream

There are several cases where the running transaction can get buffers added to
its BJ_Metadata list which it never dirtied, which makes its t_nr_buffers
counter end up larger than its t_outstanding_credits counter.

This will cause issues when starting new transactions as while we are logging
buffers we decrement t_outstanding_buffers, so when t_outstanding_buffers goes
negative, we will report that we need less space in the journal than we
actually need, so transactions will be started even though there may not be
enough room for them.  In the worst case scenario (which admittedly is almost
impossible to reproduce) this will result in the journal running out of space.

The fix is to only
refile buffers from the committing transaction to the running transactions
BJ_Modified list when b_modified is set on that journal, which is the only way
to be sure if the running transaction has modified that buffer.

This patch also fixes an accounting error in journal_forget, it is possible
that we can call journal_forget on a buffer without having modified it, only
gotten write access to it, so instead of freeing a credit, we only do so if
the buffer was modified.  The assert will help catch if this problem occurs.
Without these two patches I could hit this assert within minutes of running
postmark, with them this issue no longer arises.  Thank you,

Signed-off-by: Josef Bacik <jbacik@redhat.com>
Cc: <linux-ext4@vger.kernel.org>
Acked-by: Jan Kara <jack@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/jbd/commit.c
fs/jbd/transaction.c