Re: [PATCH 4/4] fs/ntfs3: Update valid size if -EIOCBQUEUED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 25, 2021 at 07:59:56PM +0300, Konstantin Komarov wrote:
> Update valid size if write is still in I/O queue.
> Fixes xfstest generic/240

generic/240		[21:23:16][   17.933690] run fstests generic/240 at 2021-10-26 21:23:16
 [21:23:18] 2s
Ran: generic/240
Passed all 1 tests

> Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
> 
> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@xxxxxxxxxxxxxxxxxxxx>
> ---
>  fs/ntfs3/inode.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
> index 859951d785cb..c211c64e6b17 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,14 @@ 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 && -EIOCBQUEUED == ret)

ret == -EIOCBQUEUED 

> +		end = vbo + iter_count;

Use iov_iter_count() instead of tmp var?

> +	else {

Take brackets off.

>  		goto out;
> +	}
>  
> -	end = vbo + ret;
>  	valid = ni->i_valid;
>  	if (wr) {
>  		if (end > valid && !S_ISBLK(inode->i_mode)) {
> -- 
> 2.33.0
> 
> 
> 



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux