From: Jan Kara <jack@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, Christian Brauner <brauner@kernel.org>,
Josef Bacik <josef@toxicpanda.com>,
Christoph Hellwig <hch@lst.de>,
Miklos Szeredi <miklos@szeredi.hu>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org,
kernel test robot <oliver.sang@intel.com>
Subject: Re: [PATCH] remap_range: merge do_clone_file_range() into vfs_clone_file_range()
Date: Mon, 5 Feb 2024 11:24:09 +0100 [thread overview]
Message-ID: <20240205102409.4jppi3gp23e542gi@quack3> (raw)
In-Reply-To: <CAOQ4uxgQqL_5fTSVpTB=HScyJOkx8Gz6YOr7ZeiV9Wm0Rt3hVw@mail.gmail.com>
On Fri 02-02-24 14:08:07, Amir Goldstein wrote:
> On Fri, Feb 2, 2024 at 1:44 PM Jan Kara <jack@suse.cz> wrote:
> > > + /* Try to use clone_file_range to clone up within the same fs */
> > > + cloned = vfs_clone_file_range(old_file, 0, new_file, 0, len, 0);
> > > + if (cloned == len)
> > > + goto out_fput;
> > > +
> > > + /* Couldn't clone, so now we try to copy the data */
> > > error = rw_verify_area(READ, old_file, &old_pos, len);
> > > if (!error)
> > > error = rw_verify_area(WRITE, new_file, &new_pos, len);
> > > if (error)
> > > goto out_fput;
> >
> > Do we need to keep these rw_verify_area() checks here when
> > vfs_clone_file_range() already did remap_verify_area()?
>
> Yes, because in the common case of no clone support (e.g. ext4),
> the permission hooks in vfs_clone_file_range() will not be called.
>
> There is a corner case where fs supports clone, but for some reason
> rejects this specific clone request, although there is no apparent
> reason to reject a clone request for the entire file range.
>
> In that case, permission hooks will be called twice - no big deal -
> that is exactly like a fallback in userspace cp --reflink=auto that
> will end up calling permission hooks twice in this corner case.
I see. Thanks for explanation!
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2024-02-05 10:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 10:22 [PATCH] remap_range: merge do_clone_file_range() into vfs_clone_file_range() Amir Goldstein
2024-02-02 11:44 ` Jan Kara
2024-02-02 12:08 ` Amir Goldstein
2024-02-05 10:24 ` Jan Kara [this message]
2024-02-02 12:52 ` Christian Brauner
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=20240205102409.4jppi3gp23e542gi@quack3 \
--to=jack@suse.cz \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=hch@lst.de \
--cc=josef@toxicpanda.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=oliver.sang@intel.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).