From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anna Schumaker Subject: [PATCH v1 4/8] btrfs: Add mountpoint checking during btrfs_copy_file_range Date: Fri, 4 Sep 2015 16:16:58 -0400 Message-ID: <1441397823-1203-5-git-send-email-Anna.Schumaker@Netapp.com> References: <1441397823-1203-1-git-send-email-Anna.Schumaker@Netapp.com> Mime-Version: 1.0 Content-Type: text/plain To: , , , , , , , , , , Return-path: In-Reply-To: <1441397823-1203-1-git-send-email-Anna.Schumaker-ZwjVKphTwtPQT0dZR+AlfA@public.gmane.org> Sender: linux-nfs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-fsdevel.vger.kernel.org We need to verify that both the source and the destination files are part of the same filesystem, otherwise we can't create a reflink. Signed-off-by: Anna Schumaker --- fs/btrfs/ioctl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 62ae286..9c0c955 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -3856,6 +3856,10 @@ ssize_t btrfs_copy_file_range(struct file *file_in, loff_t pos_in, { ssize_t ret; + if (inode_in->i_sb != inode_out->i_sb || + file_in->f_path.mnt != file_out->f_path.mnt) + return -EXDEV; + ret = btrfs_clone_files(file_out, file_in, pos_in, len, pos_out); if (ret == 0) ret = len; -- 2.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html