Message ID | 1443205479-13563-7-git-send-email-tao.peng@primarydata.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Peng, [auto build test results on v4.3-rc2 -- if it's inappropriate base, please ignore] config: x86_64-randconfig-x005-09251258 (attached as .config) reproduce: git checkout c66af182efac4295052614803f6e2fa5c6bb7a46 # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): fs/nfs/nfs4file.c: In function 'nfs4_ioctl': >> fs/nfs/nfs4file.c:305:15: warning: unused variable 'argp' [-Wunused-variable] void __user *argp = (void __user *)arg; ^ vim +/argp +305 fs/nfs/nfs4file.c 289 return ret; 290 } 291 292 static long nfs42_ioctl_clone_range(struct file *dst_file, void __user *argp) 293 { 294 struct nfs_ioctl_clone_range_args args; 295 296 if (copy_from_user(&args, argp, sizeof(args))) 297 return -EFAULT; 298 299 return nfs42_ioctl_clone(dst_file, args.src_fd, args.src_off, args.dst_off, args.count); 300 } 301 #endif /* CONFIG_NFS_V4_2 */ 302 303 long nfs4_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 304 { > 305 void __user *argp = (void __user *)arg; 306 307 switch (cmd) { 308 #ifdef CONFIG_NFS_V4_2 309 case NFS_IOC_CLONE: 310 return nfs42_ioctl_clone(file, arg, 0, 0, 0); 311 case NFS_IOC_CLONE_RANGE: 312 return nfs42_ioctl_clone_range(file, argp); 313 #endif --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index 4f463dd..4384a1d 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c @@ -288,14 +288,28 @@ out_drop_write: mnt_drop_write_file(dst_file); return ret; } + +static long nfs42_ioctl_clone_range(struct file *dst_file, void __user *argp) +{ + struct nfs_ioctl_clone_range_args args; + + if (copy_from_user(&args, argp, sizeof(args))) + return -EFAULT; + + return nfs42_ioctl_clone(dst_file, args.src_fd, args.src_off, args.dst_off, args.count); +} #endif /* CONFIG_NFS_V4_2 */ long nfs4_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + switch (cmd) { #ifdef CONFIG_NFS_V4_2 case NFS_IOC_CLONE: return nfs42_ioctl_clone(file, arg, 0, 0, 0); + case NFS_IOC_CLONE_RANGE: + return nfs42_ioctl_clone_range(file, argp); #endif } diff --git a/include/uapi/linux/nfs.h b/include/uapi/linux/nfs.h index d85748d..c6b86cc 100644 --- a/include/uapi/linux/nfs.h +++ b/include/uapi/linux/nfs.h @@ -33,7 +33,14 @@ /* NFS ioctls */ /* Let's follow btrfs lead on CLONE to avoid messing userspace */ -#define NFS_IOC_CLONE _IOW(0x94, 9, int) +#define NFS_IOC_CLONE _IOW(0x94, 9, int) +#define NFS_IOC_CLONE_RANGE _IOW(0x94, 13, int) + +struct nfs_ioctl_clone_range_args { + __s64 src_fd; + __u64 src_off, count; + __u64 dst_off; +}; /* * NFS stats. The good thing with these values is that NFSv3 errors are
It follows btrfs BTRFS_IOC_CLONE_RANGE lead on ioctl number and arguments. Signed-off-by: Peng Tao <tao.peng@primarydata.com> --- fs/nfs/nfs4file.c | 14 ++++++++++++++ include/uapi/linux/nfs.h | 9 ++++++++- 2 files changed, 22 insertions(+), 1 deletion(-)