From: Olga Kornievskaia <kolga@xxxxxxxxxx> Add a check to disallow cross file systems copy offload, both files are expected to be of NFS4.2+ type. Reviewed-by: Jeff Layton <jlayton@xxxxxxxxxx> Reviewed-by: Matthew Wilcox <willy@xxxxxxxxxxxxx> Signed-off-by: Olga Kornievskaia <kolga@xxxxxxxxxx> --- fs/nfs/nfs4file.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index 989f174..fde4465 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c @@ -138,11 +138,16 @@ static ssize_t nfs4_copy_file_range(struct file *file_in, loff_t pos_in, struct nl4_server *nss = NULL; nfs4_stateid *cnrs = NULL; ssize_t ret; + struct nfs_client *c_in; if (pos_in >= i_size_read(file_inode(file_in))) return -EINVAL; - if (file_inode(file_in)->i_sb != file_inode(file_out)->i_sb) + if (file_in->f_op != &nfs4_file_operations) + return -EXDEV; + + c_in = (NFS_SERVER(file_inode(file_in)))->nfs_client; + if (c_in->cl_minorversion < 2) return -EXDEV; if (file_inode(file_in) == file_inode(file_out)) -- 1.8.3.1