]> 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)
commitf6ede9b340e4dc830deaddd9982c955b11c73d84
tree3dd6214e78238293b1ac4612e7fc35775b567da0
parent6b2a4e4d974f7fc5354497cb5203ed20c4b75737
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