]> git.baikalelectronics.ru Git - kernel.git/commit
dax: fix race between simultaneous faults
authorMatthew Wilcox <willy@linux.intel.com>
Tue, 8 Sep 2015 21:59:25 +0000 (14:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 8 Sep 2015 22:35:28 +0000 (15:35 -0700)
commit7ffc68882e80a291e25dcd58de124f40998c46d6
tree3dd6214e78238293b1ac4612e7fc35775b567da0
parentfeab5bf36d7d4f0c82c954f8da15e48a15db5d4e
dax: fix race between simultaneous faults

If two threads write-fault on the same hole at the same time, the winner
of the race will return to userspace and complete their store, only to
have the loser overwrite their store with zeroes.  Fix this for now by
taking the i_mmap_sem for write instead of read, and do so outside the
call to get_block().  Now the loser of the race will see the block has
already been zeroed, and will not zero it again.

This severely limits our scalability.  I have ideas for improving it, but
those can wait for a later patch.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/dax.c
mm/memory.c