* [PATCH] ext4: Do not block RWF_NOWAIT dio write on unallocated space
@ 2020-07-08 15:35 Jan Kara
2020-07-08 17:55 ` Ritesh Harjani
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jan Kara @ 2020-07-08 15:35 UTC (permalink / raw)
To: Ted Tso; +Cc: linux-ext4, Jan Kara
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")
Reported-by: Filipe Manana <fdmanana@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/file.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 2a01e31a032c..8f742b53f1d4 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -428,6 +428,10 @@ static ssize_t ext4_dio_write_checks(struct kiocb *iocb, struct iov_iter *from,
*/
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);
--
2.16.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: Do not block RWF_NOWAIT dio write on unallocated space
2020-07-08 15:35 [PATCH] ext4: Do not block RWF_NOWAIT dio write on unallocated space Jan Kara
@ 2020-07-08 17:55 ` Ritesh Harjani
2020-08-05 14:11 ` Jan Kara
2020-08-06 5:06 ` tytso
2 siblings, 0 replies; 4+ messages in thread
From: Ritesh Harjani @ 2020-07-08 17:55 UTC (permalink / raw)
To: Jan Kara, Ted Tso; +Cc: linux-ext4
On 7/8/20 9:05 PM, Jan Kara wrote:
> 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")
> Reported-by: Filipe Manana <fdmanana@gmail.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
LGTM, feel free to add
Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>
> ---
> fs/ext4/file.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/fs/ext4/file.c b/fs/ext4/file.c
> index 2a01e31a032c..8f742b53f1d4 100644
> --- a/fs/ext4/file.c
> +++ b/fs/ext4/file.c
> @@ -428,6 +428,10 @@ static ssize_t ext4_dio_write_checks(struct kiocb *iocb, struct iov_iter *from,
> */
> 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);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: Do not block RWF_NOWAIT dio write on unallocated space
2020-07-08 15:35 [PATCH] ext4: Do not block RWF_NOWAIT dio write on unallocated space Jan Kara
2020-07-08 17:55 ` Ritesh Harjani
@ 2020-08-05 14:11 ` Jan Kara
2020-08-06 5:06 ` tytso
2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2020-08-05 14:11 UTC (permalink / raw)
To: Ted Tso; +Cc: linux-ext4, Jan Kara
On Wed 08-07-20 17:35:16, Jan Kara wrote:
> 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")
> Reported-by: Filipe Manana <fdmanana@gmail.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
Ted, can you please merge this patch? Thanks!
Honza
> ---
> fs/ext4/file.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/fs/ext4/file.c b/fs/ext4/file.c
> index 2a01e31a032c..8f742b53f1d4 100644
> --- a/fs/ext4/file.c
> +++ b/fs/ext4/file.c
> @@ -428,6 +428,10 @@ static ssize_t ext4_dio_write_checks(struct kiocb *iocb, struct iov_iter *from,
> */
> 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);
> --
> 2.16.4
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: Do not block RWF_NOWAIT dio write on unallocated space
2020-07-08 15:35 [PATCH] ext4: Do not block RWF_NOWAIT dio write on unallocated space Jan Kara
2020-07-08 17:55 ` Ritesh Harjani
2020-08-05 14:11 ` Jan Kara
@ 2020-08-06 5:06 ` tytso
2 siblings, 0 replies; 4+ messages in thread
From: tytso @ 2020-08-06 5:06 UTC (permalink / raw)
To: Jan Kara; +Cc: linux-ext4
On Wed, Jul 08, 2020 at 05:35:16PM +0200, Jan Kara wrote:
> 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")
> Reported-by: Filipe Manana <fdmanana@gmail.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
Applied, thanks.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-06 11:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08 15:35 [PATCH] ext4: Do not block RWF_NOWAIT dio write on unallocated space Jan Kara
2020-07-08 17:55 ` Ritesh Harjani
2020-08-05 14:11 ` Jan Kara
2020-08-06 5:06 ` tytso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).