android_kernel_xiaomi_sm8350/fs/jbd
Jan Kara 4407c2b6b2 [PATCH] Fix race in do_get_write_access()
attached patch should fix the following race:
     Proc 1                               Proc 2

     __flush_batch()
       ll_rw_block()
                                        do_get_write_access()
					   lock_buffer
                                             jh is only waiting for checkpoint
					     -> b_transaction == NULL ->
					     do nothing
                                           unlock_buffer
    test_set_buffer_locked()
    test_clear_buffer_dirty()
                                           __journal_file_buffer()
                                        change the data
    submit_bh()

and we have sent wrong data to disk...  We now clean the dirty buffer flag
under buffer lock in all cases and hence we know that whenever a buffer is
starting to be journaled we either finish the pending write-out before
attaching a buffer to a transaction or we won't write the buffer until the
transaction is going to be committed.

The test in jbd_unexpected_dirty_buffer() is redundant - remove it.
Furthermore we have to clear the buffer dirty bit under the buffer lock to
prevent races with buffer write-out (and hence prevent returning a buffer with
IO happening).

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-07 16:57:57 -07:00
..
checkpoint.c [PATCH] Change ll_rw_block() calls in JBD 2005-09-07 16:57:55 -07:00
commit.c [PATCH] Change ll_rw_block() calls in JBD 2005-09-07 16:57:55 -07:00
journal.c [PATCH] Change ll_rw_block() calls in JBD 2005-09-07 16:57:55 -07:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
recovery.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
revoke.c [PATCH] Change ll_rw_block() calls in JBD 2005-09-07 16:57:55 -07:00
transaction.c [PATCH] Fix race in do_get_write_access() 2005-09-07 16:57:57 -07:00