public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Carlos Maiolino <cem@kernel.org>,
	Ojaswin Mujoo <ojaswin@linux.ibm.com>,
	Zorro Lang <zlang@redhat.com>,
	fstests@vger.kernel.org, Ritesh Harjani <ritesh.list@gmail.com>,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/2] xfs: fix various problems in xfs_atomic_write_cow_iomap_begin
Date: Wed, 5 Nov 2025 12:21:15 +0000	[thread overview]
Message-ID: <e5fa77c8-5293-47be-9f66-addcf458529d@oracle.com> (raw)
In-Reply-To: <20251104171801.GL196370@frogsfrogsfrogs>

On 04/11/2025 17:18, Darrick J. Wong wrote:
>> Can you point out that code? I wonder if we should be rejecting anything
>> which goes over s_maxbytes for RWF_ATOMIC.
> generic_write_check_limits:
> https://urldefense.com/v3/__https://elixir.bootlin.com/linux/v6.17.7/ 
> source/fs/read_write.c*L1709__;Iw!!ACWV5N9M2RV99hQ!M- 
> J1QmUWrGHUBb6gf9LHN33HxhBfk3rHcNR5z_glUHClffIPQ5UFQ1zmHpsetFGz3_3lHzUrwyAASD_90A$ 
> 
> xfs_file_dio_write_atomic -> xfs_file_write_checks ->
> generic_write_checks -> generic_write_checks_count ->
> generic_write_check_limits

ok, thanks for the pointer.

So should we stop any possible truncation for RWF_ATOMIC, like:

+++ b/fs/xfs/xfs_file.c
@@ -440,6 +440,9 @@ xfs_file_write_checks(
        if (error <= 0)
                return error;

+       if (error != count && iocb->ki_flags & IOCB_ATOMIC)
+               return -EINVAL;
+
        if (iocb->ki_flags & IOCB_NOWAIT) {
                error = break_layout(inode, false);
                if (error == -EWOULDBLOCK)


Note that I do realize that this may be better in generic fs code.

Thanks,
John

  reply	other threads:[~2025-11-05 12:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-03 17:40 [PATCH 1/2] xfs: fix delalloc write failures in software-provided atomic writes Darrick J. Wong
2025-11-03 17:44 ` [PATCH 2/2] xfs: fix various problems in xfs_atomic_write_cow_iomap_begin Darrick J. Wong
2025-11-04 12:07   ` John Garry
2025-11-04 17:18     ` Darrick J. Wong
2025-11-05 12:21       ` John Garry [this message]
2025-11-05 19:18         ` Darrick J. Wong
2025-11-04 10:08 ` [PATCH 1/2] xfs: fix delalloc write failures in software-provided atomic writes John Garry
2025-11-04 17:24   ` Darrick J. Wong

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=e5fa77c8-5293-47be-9f66-addcf458529d@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=zlang@redhat.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