Re: [PATCH] xfs: Call kiocb_modified() for buffered write

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

 




On 11/16/22 6:42 AM, Xiao Yang wrote:
> kiocb_modified() should be used for sync/async buffered write
> because it will return -EAGAIN when IOCB_NOWAIT is set. Unfortunately,
> kiocb_modified() is used by the common xfs_file_write_checks()
> which is called by all types of write(i.e. buffered/direct/dax write).
> This issue makes generic/471 with xfs always get the following error:
> --------------------------------------------------------
> QA output created by 471
> pwrite: Resource temporarily unavailable
> wrote 8388608/8388608 bytes at offset 0
> XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> pwrite: Resource temporarily unavailable
> ...
> --------------------------------------------------------
> 

There have been earlier discussions about this. Snippet from the
earlier discussion:

"generic/471 complains because it expects any write done with RWF_NOWAIT
to succeed as long as the blocks for the write are already instantiated.
This isn't necessarily a correct assumption, as there are other conditions
that can cause an RWF_NOWAIT write to fail with -EAGAIN even if the range
is already there."

So the test itself probably needs fixing.

> Fixes: 1aa91d9c9933 ("xfs: Add async buffered write support")
> Signed-off-by: Xiao Yang <yangx.jy@xxxxxxxxxxx>
> ---
>  fs/xfs/xfs_file.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index e462d39c840e..561fab3a49c7 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -417,6 +417,9 @@ xfs_file_write_checks(
>  		spin_unlock(&ip->i_flags_lock);
>  
>  out:
> +	if (IS_DAX(inode) || (iocb->ki_flags & IOCB_DIRECT))
> +		return file_modified(file);
> +
>  	return kiocb_modified(iocb);
>  }
>  



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux