]> www.infradead.org Git - users/jedix/linux-maple.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)
committerDan Duval <dan.duval@oracle.com>
Wed, 7 Dec 2016 17:19:46 +0000 (12:19 -0500)
commit530a98518f21825adf9663eb04bec4b0102034e0
tree160c588d80706cd09c054e4a9b4c5775a3161883
parent1ba4997eae536e0cb4feb0af2f145bf7ba56eb17
dax: fix race between simultaneous faults

Orabug: 22913653

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>
(cherry picked from commit 843172978bb92997310d2f7fbc172ece423cfc02)
Signed-off-by: Dan Duval <dan.duval@oracle.com>
fs/dax.c
mm/memory.c