linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Julian Sun <sunjunchao2870@gmail.com>,
	linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org,
	viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz,
	stable@vger.kernel.org
Subject: Re: [PATCH 3/3] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails
Date: Fri, 20 Sep 2024 08:02:13 -0700	[thread overview]
Message-ID: <20240920150213.GD21853@frogsfrogsfrogs> (raw)
In-Reply-To: <Zu2NeawWugiaWxKA@infradead.org>

On Fri, Sep 20, 2024 at 07:58:01AM -0700, Christoph Hellwig wrote:
> On Fri, Sep 20, 2024 at 07:37:27AM -0700, Darrick J. Wong wrote:
> > On Fri, Sep 20, 2024 at 07:19:28AM -0700, Christoph Hellwig wrote:
> > > On Fri, Sep 20, 2024 at 08:30:22PM +0800, Julian Sun wrote:
> > > > Keep it consistent with the handling of the same check within
> > > > generic_copy_file_checks().
> > > > Also, returning -EOVERFLOW in this case is more appropriate.
> > > 
> > > Maybe:
> > > 
> > > Keep the errno value consistent with the equivalent check in
> > > generic_copy_file_checks() that returns -EOVERFLOW, which feels like the
> > > more appropriate value to return compared to the overly generic -EINVAL.
> > 
> > The manpage for clone/dedupe/exchange don't say anything about
> > EOVERFLOW, but they do have this to say about EINVAL:
> > 
> > EINVAL
> > The  filesystem  does  not  support  reflinking the ranges of the given
> > files.
> 
> Which isn't exactly the integer overflow case described here :)

Hm?  This patch is touching the error code you get for failing alignment
checks, not the one you get for failing check_add_overflow.  EOVERFLOW
seems like an odd return code for unaligned arguments.  Though you're
right that EINVAL is verrry vague.

> > Does this errno code change cause any regressions in fstests?
> 
> Given our rather sparse test coverage of it I doubt it, but it
> would be great to have that confirmed by the submitter.

Yes. :)

> While we're talking about that - a simple exerciser for the overflow
> condition for xfstests would be very useful to have.

Yes, there's <cough> supposed to be one that does that.

$ git grep -ci CLONE.*invalid.argument
common/filter.btrfs:1
tests/btrfs/035.out:1
tests/btrfs/052.out:12
tests/btrfs/096.out:1
tests/btrfs/112.out:16
tests/btrfs/113.out:1
tests/btrfs/229:1
tests/generic/157.out:6
tests/generic/303.out:4
tests/generic/518.out:1


--D

  reply	other threads:[~2024-09-20 15:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-20 12:30 [PATCH 3/3] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails Julian Sun
2024-09-20 14:19 ` Christoph Hellwig
2024-09-20 14:37   ` Darrick J. Wong
2024-09-20 14:58     ` Christoph Hellwig
2024-09-20 15:02       ` Darrick J. Wong [this message]
2024-09-20 15:07         ` Christoph Hellwig
2024-09-20 16:10           ` Julian Sun

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=20240920150213.GD21853@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=brauner@kernel.org \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=sunjunchao2870@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).