]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit2d31c53c793824188c05b2cb48b457a660af7a85
treeaa752d4685f5702976683401dadb7557f161d62d
parentf59fa4d537373c497c4f4a1ab6d604ea418acb6f
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