ext4: don't block for O_DIRECT if IOCB_NOWAIT is set
authorJens Axboe <axboe@kernel.dk>
Sun, 24 May 2020 22:53:16 +0000 (16:53 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:49:03 +0000 (17:49 +0200)
commit255bc2b4994e20772dce0069ae049d5a0424d5e0
tree2ef7bbb4d4d0d43f26bdde88d5afc5c34c3daa87
parent2ade6388e146d9d5a6fb93f45b5ca48c38969e4e
ext4: don't block for O_DIRECT if IOCB_NOWAIT is set

[ Upstream commit 6e014c621e7271649f0d51e54dbe1db4c10486c8 ]

Running with some debug patches to detect illegal blocking triggered the
extend/unaligned condition in ext4. If ext4 needs to extend the file (and
hence go to buffered IO), or if the app is doing unaligned IO, then ext4
asks the iomap code to wait for IO completion. If the caller asked for
no-wait semantics by setting IOCB_NOWAIT, then ext4 should return -EAGAIN
instead.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/76152096-2bbb-7682-8fce-4cb498bcd909@kernel.dk
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ext4/file.c