]> git.baikalelectronics.ru Git - kernel.git/commit
fs: Avoid invalidation in interrupt context in dio_complete()
authorLukas Czerner <lczerner@redhat.com>
Tue, 17 Oct 2017 14:43:09 +0000 (08:43 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 17 Oct 2017 14:43:09 +0000 (08:43 -0600)
commita95c723726288a465f030b75459715c241438c4f
treeceaf9afe924903913d20088bdb2065a108481677
parentb8d12a8bed7888b009d95f03aeef7c9948a8b7a3
fs: Avoid invalidation in interrupt context in dio_complete()

Currently we try to defer completion of async DIO to the process context
in case there are any mapped pages associated with the inode so that we
can invalidate the pages when the IO completes. However the check is racy
and the pages can be mapped afterwards. If this happens we might end up
calling invalidate_inode_pages2_range() in dio_complete() in interrupt
context which could sleep. This can be reproduced by generic/451.

Fix this by passing the information whether we can or can't invalidate
to the dio_complete(). Thanks Eryu Guan for reporting this and Jan Kara
for suggesting a fix.

Fixes: ab1529b04d8a ("fs: Fix page cache inconsistency when mixing buffered and AIO DIO")
Reported-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Tested-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/direct-io.c