mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
Ensure we call fput when cloning fails due to different devices.
Right now, zpl_ioctl_ficlone and zpl_ioctl_ficlonerange do not call put on the src fd if the source and destination are on two different devices. This leaves the source file held open in this case. Reviewed-by: Kay Pedersen <mail@mkwg.de> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Daniel Berlin <dberlin@dberlin.org> Closes #15386
This commit is contained in:
parent
483ccf0c63
commit
bc29124b1b
@ -202,8 +202,10 @@ zpl_ioctl_ficlone(struct file *dst_file, void *arg)
|
|||||||
if (src_file == NULL)
|
if (src_file == NULL)
|
||||||
return (-EBADF);
|
return (-EBADF);
|
||||||
|
|
||||||
if (dst_file->f_op != src_file->f_op)
|
if (dst_file->f_op != src_file->f_op) {
|
||||||
|
fput(src_file);
|
||||||
return (-EXDEV);
|
return (-EXDEV);
|
||||||
|
}
|
||||||
|
|
||||||
size_t len = i_size_read(file_inode(src_file));
|
size_t len = i_size_read(file_inode(src_file));
|
||||||
|
|
||||||
@ -237,8 +239,10 @@ zpl_ioctl_ficlonerange(struct file *dst_file, void __user *arg)
|
|||||||
if (src_file == NULL)
|
if (src_file == NULL)
|
||||||
return (-EBADF);
|
return (-EBADF);
|
||||||
|
|
||||||
if (dst_file->f_op != src_file->f_op)
|
if (dst_file->f_op != src_file->f_op) {
|
||||||
|
fput(src_file);
|
||||||
return (-EXDEV);
|
return (-EXDEV);
|
||||||
|
}
|
||||||
|
|
||||||
size_t len = fcr.fcr_src_length;
|
size_t len = fcr.fcr_src_length;
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user