zfs: fall back if block_cloning feature is disabled
If block_cloning is disabled, or other errors from zfs_clone_range() return an EXDEV we should fall back to vn_generic_copy_file_range(). This fixes issues when copying files on the same dataset with block_cloning disabled. Upstreamed as pull request to OpenZFS. Reviewed by: Mateusz Guzik <mjguzik@gmail.com> OpenZFS pull request: 14713
This commit is contained in:
parent
76fa62b523
commit
8ee579abe0
@ -6243,13 +6243,6 @@ zfs_freebsd_copy_file_range(struct vop_copy_file_range_args *ap)
|
|||||||
int error;
|
int error;
|
||||||
uint64_t len = *ap->a_lenp;
|
uint64_t len = *ap->a_lenp;
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: If offset/length is not aligned to recordsize, use
|
|
||||||
* vn_generic_copy_file_range() on this fragment.
|
|
||||||
* It would be better to do this after we lock the vnodes, but then we
|
|
||||||
* need something else than vn_generic_copy_file_range().
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Lock both vnodes, avoiding risk of deadlock. */
|
/* Lock both vnodes, avoiding risk of deadlock. */
|
||||||
do {
|
do {
|
||||||
mp = NULL;
|
mp = NULL;
|
||||||
@ -6300,6 +6293,16 @@ zfs_freebsd_copy_file_range(struct vop_copy_file_range_args *ap)
|
|||||||
if (mp != NULL)
|
if (mp != NULL)
|
||||||
vn_finished_write(mp);
|
vn_finished_write(mp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fall back if block_cloning feature is disabled
|
||||||
|
* or other EXDEV failures from zfs_vnops.c
|
||||||
|
*/
|
||||||
|
if (error == EXDEV) {
|
||||||
|
error = vn_generic_copy_file_range(ap->a_invp, ap->a_inoffp,
|
||||||
|
ap->a_outvp, ap->a_outoffp, ap->a_lenp, ap->a_flags,
|
||||||
|
ap->a_incred, ap->a_outcred, ap->a_fsizetd);
|
||||||
|
}
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user