aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2019-06-05 11:04:47 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2019-06-09 13:06:19 -0400
commit64bf5ff58dff757253cf2142542672de4b21cd1a (patch)
tree45cacb386c21b2778cc9a0562e5ee3aa0b2924be /fs/nfs
parentf16acc9d9b3761ae5e45219c9302f99e20919829 (diff)
vfs: no fallback for ->copy_file_range
Now that we have generic_copy_file_range(), remove it as a fallback case when offloads fail. This puts the responsibility for executing fallbacks on the filesystems that implement ->copy_file_range and allows us to add operational validity checks to generic_copy_file_range(). Rework vfs_copy_file_range() to call a new do_copy_file_range() helper to execute the copying callout, and move calls to generic_file_copy_range() into filesystem methods where they currently return failures. [Amir] overlayfs is not responsible of executing the fallback. It is the responsibility of the underlying filesystem. Signed-off-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4file.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index cf42a8b939e3..4842f3ab3161 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -129,9 +129,9 @@ nfs4_file_flush(struct file *file, fl_owner_t id)
129} 129}
130 130
131#ifdef CONFIG_NFS_V4_2 131#ifdef CONFIG_NFS_V4_2
132static ssize_t nfs4_copy_file_range(struct file *file_in, loff_t pos_in, 132static ssize_t __nfs4_copy_file_range(struct file *file_in, loff_t pos_in,
133 struct file *file_out, loff_t pos_out, 133 struct file *file_out, loff_t pos_out,
134 size_t count, unsigned int flags) 134 size_t count, unsigned int flags)
135{ 135{
136 if (!nfs_server_capable(file_inode(file_out), NFS_CAP_COPY)) 136 if (!nfs_server_capable(file_inode(file_out), NFS_CAP_COPY))
137 return -EOPNOTSUPP; 137 return -EOPNOTSUPP;
@@ -140,6 +140,20 @@ static ssize_t nfs4_copy_file_range(struct file *file_in, loff_t pos_in,
140 return nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count); 140 return nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count);
141} 141}
142 142
143static ssize_t nfs4_copy_file_range(struct file *file_in, loff_t pos_in,
144 struct file *file_out, loff_t pos_out,
145 size_t count, unsigned int flags)
146{
147 ssize_t ret;
148
149 ret = __nfs4_copy_file_range(file_in, pos_in, file_out, pos_out, count,
150 flags);
151 if (ret == -EOPNOTSUPP)
152 ret = generic_copy_file_range(file_in, pos_in, file_out,
153 pos_out, count, flags);
154 return ret;
155}
156
143static loff_t nfs4_file_llseek(struct file *filep, loff_t offset, int whence) 157static loff_t nfs4_file_llseek(struct file *filep, loff_t offset, int whence)
144{ 158{
145 loff_t ret; 159 loff_t ret;