[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200824082415.158803371@linuxfoundation.org>
Date: Mon, 24 Aug 2020 10:28:43 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, stable@...nel.org,
Filipe Manana <fdmanana@...il.com>, Jan Kara <jack@...e.cz>,
Ritesh Harjani <riteshh@...ux.ibm.com>,
Theodore Tso <tytso@....edu>
Subject: [PATCH 5.8 025/148] ext4: do not block RWF_NOWAIT dio write on unallocated space
From: Jan Kara <jack@...e.cz>
commit 0b3171b6d195637f84ddf8b59bae818ea20bc8ac upstream.
Since commit 378f32bab371 ("ext4: introduce direct I/O write using iomap
infrastructure") we don't properly bail out of RWF_NOWAIT direct IO
write if underlying blocks are not allocated. Also
ext4_dio_write_checks() does not honor RWF_NOWAIT when re-acquiring
i_rwsem. Fix both issues.
Fixes: 378f32bab371 ("ext4: introduce direct I/O write using iomap infrastructure")
Cc: stable@...nel.org
Reported-by: Filipe Manana <fdmanana@...il.com>
Signed-off-by: Jan Kara <jack@...e.cz>
Reviewed-by: Ritesh Harjani <riteshh@...ux.ibm.com>
Link: https://lore.kernel.org/r/20200708153516.9507-1-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@....edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/ext4/file.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -428,6 +428,10 @@ restart:
*/
if (*ilock_shared && (!IS_NOSEC(inode) || *extend ||
!ext4_overwrite_io(inode, offset, count))) {
+ if (iocb->ki_flags & IOCB_NOWAIT) {
+ ret = -EAGAIN;
+ goto out;
+ }
inode_unlock_shared(inode);
*ilock_shared = false;
inode_lock(inode);
Powered by blists - more mailing lists