Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Stefan Roesch <shr@meta.com>
To: Xiao Yang <yangx.jy@fujitsu.com>, shr@fb.com, djwong@kernel.org
Cc: linux-xfs@vger.kernel.org, ruansy.fnst@fujitsu.com
Subject: Re: [PATCH] xfs: Call kiocb_modified() for buffered write
Date: Wed, 16 Nov 2022 11:00:33 -0800	[thread overview]
Message-ID: <15e09968-8395-c8e4-aa6e-aa11b29fa175@meta.com> (raw)
In-Reply-To: <1668609741-14-1-git-send-email-yangx.jy@fujitsu.com>



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@fujitsu.com>
> ---
>  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);
>  }
>  

  reply	other threads:[~2022-11-16 19:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 14:42 [PATCH] xfs: Call kiocb_modified() for buffered write Xiao Yang
2022-11-16 19:00 ` Stefan Roesch [this message]
2022-11-17  2:28   ` Yang, Xiao/杨 晓
2023-01-13  4:55     ` yangx.jy
2023-01-13 18:02       ` Stefan Roesch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15e09968-8395-c8e4-aa6e-aa11b29fa175@meta.com \
    --to=shr@meta.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ruansy.fnst@fujitsu.com \
    --cc=shr@fb.com \
    --cc=yangx.jy@fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox