]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - fs/direct-io.c
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)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 15 Mar 2018 13:27:45 +0000 (08:27 -0500)
commite95d8ba5f6d7a52d54ab84b77c020e30a4484581
tree20188a889b65f7a9ef73c7a65061b1c063c5c7fc
parentfeb5e8a4dab5da1ccccb1185feecd64dbd3b5eb9
direct-io: Fix sleep in atomic due to sync AIO

BugLink: http://bugs.launchpad.net/bugs/1755179
commit d9c10e5b8863cfb6886d1640386455075c6e979d upstream.

Commit e864f39569f4 "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 9830f4be159b "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: 9830f4be159b29399d107bffb99e0132bc5aedd4
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
fs/direct-io.c