linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Josef Bacik <josef@toxicpanda.com>
Cc: viro@ZenIV.linux.org.uk, linux-fsdevel@vger.kernel.org,
	linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] fs: allow cross-vfsmount reflink/dedupe
Date: Wed, 16 Feb 2022 19:05:55 -0800	[thread overview]
Message-ID: <20220217030555.GA8253@magnolia> (raw)
In-Reply-To: <67ae4c62a4749ae6870c452d1b458cc5f48b8263.1645042835.git.josef@toxicpanda.com>

On Wed, Feb 16, 2022 at 03:21:23PM -0500, Josef Bacik wrote:
> Currently we disallow reflink and dedupe if the two files aren't on the
> same vfsmount.  However we really only need to disallow it if they're
> not on the same super block.  It is very common for btrfs to have a main
> subvolume that is mounted and then different subvolumes mounted at
> different locations.  It's allowed to reflink between these volumes, but
> the vfsmount check disallows this.  Instead fix dedupe to check for the
> same superblock, and simply remove the vfsmount check for reflink as it
> already does the superblock check.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Seems pretty spiffy to /me/... ;)
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/ioctl.c       | 4 ----
>  fs/remap_range.c | 7 +------
>  2 files changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/fs/ioctl.c b/fs/ioctl.c
> index 1ed097e94af2..090bf47606ab 100644
> --- a/fs/ioctl.c
> +++ b/fs/ioctl.c
> @@ -236,9 +236,6 @@ static long ioctl_file_clone(struct file *dst_file, unsigned long srcfd,
>  
>  	if (!src_file.file)
>  		return -EBADF;
> -	ret = -EXDEV;
> -	if (src_file.file->f_path.mnt != dst_file->f_path.mnt)
> -		goto fdput;
>  	cloned = vfs_clone_file_range(src_file.file, off, dst_file, destoff,
>  				      olen, 0);
>  	if (cloned < 0)
> @@ -247,7 +244,6 @@ static long ioctl_file_clone(struct file *dst_file, unsigned long srcfd,
>  		ret = -EINVAL;
>  	else
>  		ret = 0;
> -fdput:
>  	fdput(src_file);
>  	return ret;
>  }
> diff --git a/fs/remap_range.c b/fs/remap_range.c
> index 231159682907..bc5fb006dc79 100644
> --- a/fs/remap_range.c
> +++ b/fs/remap_range.c
> @@ -362,11 +362,6 @@ loff_t do_clone_file_range(struct file *file_in, loff_t pos_in,
>  
>  	WARN_ON_ONCE(remap_flags & REMAP_FILE_DEDUP);
>  
> -	/*
> -	 * FICLONE/FICLONERANGE ioctls enforce that src and dest files are on
> -	 * the same mount. Practically, they only need to be on the same file
> -	 * system.
> -	 */
>  	if (file_inode(file_in)->i_sb != file_inode(file_out)->i_sb)
>  		return -EXDEV;
>  
> @@ -458,7 +453,7 @@ loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
>  		goto out_drop_write;
>  
>  	ret = -EXDEV;
> -	if (src_file->f_path.mnt != dst_file->f_path.mnt)
> +	if (file_inode(src_file)->i_sb != file_inode(dst_file)->i_sb)
>  		goto out_drop_write;
>  
>  	ret = -EISDIR;
> -- 
> 2.26.3
> 

  reply	other threads:[~2022-02-17  3:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 20:21 [PATCH] fs: allow cross-vfsmount reflink/dedupe Josef Bacik
2022-02-17  3:05 ` Darrick J. Wong [this message]
2022-02-17  4:52 ` Wang Yugui
2022-02-17  4:59   ` NeilBrown
2022-02-17  6:54     ` Wang Yugui
2022-02-21 21:59       ` NeilBrown
2022-02-21 23:53         ` NeilBrown
2022-02-22  1:56           ` Wang Yugui
2022-02-18 13:19 ` David Sterba
2022-02-18 13:22 ` Nikolay Borisov

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=20220217030555.GA8253@magnolia \
    --to=djwong@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --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).