]> git.kernelconcepts.de Git - karo-tx-linux.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)
commit843172978bb92997310d2f7fbc172ece423cfc02
tree3dd6214e78238293b1ac4612e7fc35775b567da0
parent01a33b4ace68bc35679a347f21d5ed6e222e30dc
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