From: "Darrick J. Wong" <djwong@kernel.org>
To: John Garry <john.g.garry@oracle.com>
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 11:18:06 -0800 [thread overview]
Message-ID: <20251105191806.GE196370@frogsfrogsfrogs> (raw)
In-Reply-To: <e5fa77c8-5293-47be-9f66-addcf458529d@oracle.com>
On Wed, Nov 05, 2025 at 12:21:15PM +0000, John Garry wrote:
> 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.
Yeah, I think that'd be better placed in generic_write_checks_count if
_limit() changes &count.
--D
> Thanks,
> John
>
next prev parent reply other threads:[~2025-11-05 19:18 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
2025-11-05 19:18 ` Darrick J. Wong [this message]
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=20251105191806.GE196370@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=john.g.garry@oracle.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.