]> git.karo-electronics.de Git - karo-tx-linux.git/commit
jbd: fix fsync() tid wraparound bug
authorTed Ts'o <tytso@mit.edu>
Sat, 30 Apr 2011 17:17:11 +0000 (13:17 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 23 Jun 2011 22:24:01 +0000 (15:24 -0700)
commitcdc57f82fec758aec8d812d6622dadf77920a600
tree5eed8dabb33157c13cddf7eb3f7900b228d4798c
parent538e7bf8cfae29e1debcd16eb50f4fdfb5c5895d
jbd: fix fsync() tid wraparound bug

commit d9b01934d56a96d9f4ae2d6204d4ea78a36f5f36 upstream.

If an application program does not make any changes to the indirect
blocks or extent tree, i_datasync_tid will not get updated.  If there
are enough commits (i.e., 2**31) such that tid_geq()'s calculations
wrap, and there isn't a currently active transaction at the time of
the fdatasync() call, this can end up triggering a BUG_ON in
fs/jbd/commit.c:

J_ASSERT(journal->j_running_transaction != NULL);

It's pretty rare that this can happen, since it requires the use of
fdatasync() plus *very* frequent and excessive use of fsync().  But
with the right workload, it can.

We fix this by replacing the use of tid_geq() with an equality test,
since there's only one valid transaction id that is valid for us to
start: namely, the currently running transaction (if it exists).

Reported-by: Martin_Zielinski@McAfee.com
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/jbd/journal.c