jbd2: fix race between write_metadata_buffer and get_write_access
authordingdinghua <dingdinghua85@gmail.com>
Mon, 13 Jul 2009 21:55:35 +0000 (17:55 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 13 Jul 2009 21:55:35 +0000 (17:55 -0400)
commit96577c43827697ca1af5982fa256a34786d0c720
treeaa752d4685f5702976683401dadb7557f161d62d
parent833576b362e15c38be3bfe43942cda693e56287c
jbd2: fix race between write_metadata_buffer and get_write_access

The function jbd2_journal_write_metadata_buffer() calls
jbd_unlock_bh_state(bh_in) too early; this could potentially allow
another thread to call get_write_access on the buffer head, modify the
data, and dirty it, and allowing the wrong data to be written into the
journal.  Fortunately, if we lose this race, the only time this will
actually cause filesystem corruption is if there is a system crash or
other unclean shutdown of the system before the next commit can take
place.

Signed-off-by: dingdinghua <dingdinghua85@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/jbd2/journal.c