Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@fujitsu.com>
To: <shr@fb.com>, <djwong@kernel.org>
Cc: <linux-xfs@vger.kernel.org>, <ruansy.fnst@fujitsu.com>,
	Xiao Yang <yangx.jy@fujitsu.com>
Subject: [PATCH] xfs: Call kiocb_modified() for buffered write
Date: Wed, 16 Nov 2022 14:42:21 +0000	[thread overview]
Message-ID: <1668609741-14-1-git-send-email-yangx.jy@fujitsu.com> (raw)

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
...
--------------------------------------------------------

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);
 }
 
-- 
2.21.0


             reply	other threads:[~2022-11-16 14:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 14:42 Xiao Yang [this message]
2022-11-16 19:00 ` [PATCH] xfs: Call kiocb_modified() for buffered write Stefan Roesch
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=1668609741-14-1-git-send-email-yangx.jy@fujitsu.com \
    --to=yangx.jy@fujitsu.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ruansy.fnst@fujitsu.com \
    --cc=shr@fb.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