]> git.baikalelectronics.ru Git - kernel.git/commit
direct-io: Fix sleep in atomic due to sync AIO
authorJan Kara <jack@suse.cz>
Mon, 26 Feb 2018 11:51:43 +0000 (12:51 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 26 Feb 2018 16:05:35 +0000 (09:05 -0700)
commit1b44959b80384aabad406af4028f090d862a5377
treeae004ec25c97c1db1ff9804f4bb6b147ca85f786
parent111f7ed483ab4f7ee2d5349b67323395de6733b9
direct-io: Fix sleep in atomic due to sync AIO

Commit 27f3873604e4 "fs: add RWF_DSYNC aand RWF_SYNC" added additional
way for direct IO to become synchronous and thus trigger fsync from the
IO completion handler. Then commit 2a2d7bcc1d67 "fs: Use RWF_* flags for
AIO operations" allowed these flags to be set for AIO as well. However
that commit forgot to update the condition checking whether the IO
completion handling should be defered to a workqueue and thus AIO DIO
with RWF_[D]SYNC set will call fsync() from IRQ context resulting in
sleep in atomic.

Fix the problem by checking directly iocb flags (the same way as it is
done in dio_complete()) instead of checking all conditions that could
lead to IO being synchronous.

CC: Christoph Hellwig <hch@lst.de>
CC: Goldwyn Rodrigues <rgoldwyn@suse.com>
CC: stable@vger.kernel.org
Reported-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Fixes: 2a2d7bcc1d670073fbd732202e2e5c6f5b756ff7
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/direct-io.c