]> git.baikalelectronics.ru Git - kernel.git/commit
jbd: fix race between write_metadata_buffer and get_write_access
authordingdinghua <dingdinghua85@gmail.com>
Wed, 15 Jul 2009 19:42:05 +0000 (21:42 +0200)
committerJan Kara <jack@suse.cz>
Tue, 21 Jul 2009 09:54:42 +0000 (11:54 +0200)
commitd4b986d787aff992f80f6a1121fe0940d1dc8a2c
tree3fb03db8dc97bf9037cbdf91b71e28a2bbb8eed3
parent0d14551344b6a8c8c74efd0672d25dd16c8c9ad2
jbd: fix race between write_metadata_buffer and get_write_access

The function 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>
Acked-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/jbd/journal.c