summaryrefslogtreecommitdiff
path: root/fs/ntfs3
diff options
context:
space:
mode:
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2021-10-25 18:48:38 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-09 11:29:28 +0300
commitcedb2fda5324826256dbd1acba8177c6e6eb2b8b (patch)
tree204532d0db159383ef192a60e89234c09ffcd495 /fs/ntfs3
parent0753245a72ec99824677586499ee2e0919164b3f (diff)
downloadlinux-cedb2fda5324826256dbd1acba8177c6e6eb2b8b.tar.xz
fs/ntfs3: Update valid size if -EIOCBQUEUED
commit 52e00ea6b26e45fb8159e3b57cdde8d3f9bdd8e9 upstream. Update valid size if write is still in I/O queue. Fixes xfstest generic/240 Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ntfs3')
-rw-r--r--fs/ntfs3/inode.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 2b0ace850cba..38045264a61b 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -757,6 +757,7 @@ static ssize_t ntfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
loff_t vbo = iocb->ki_pos;
loff_t end;
int wr = iov_iter_rw(iter) & WRITE;
+ size_t iter_count = iov_iter_count(iter);
loff_t valid;
ssize_t ret;
@@ -770,10 +771,13 @@ static ssize_t ntfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
wr ? ntfs_get_block_direct_IO_W
: ntfs_get_block_direct_IO_R);
- if (ret <= 0)
+ if (ret > 0)
+ end = vbo + ret;
+ else if (wr && ret == -EIOCBQUEUED)
+ end = vbo + iter_count;
+ else
goto out;
- end = vbo + ret;
valid = ni->i_valid;
if (wr) {
if (end > valid && !S_ISBLK(inode->i_mode)) {