aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authororomenahar <[email protected]>2023-07-27 20:32:34 +0200
committerGitHub <[email protected]>2023-07-27 11:32:34 -0700
commit5bdfff5cfc8baff48b3b59a577e7ef756a011024 (patch)
treeb9a77483f82d6a82369d709a903baaf6c1a59d5f /module
parent704c80f0487199a00c3ce5eba1b2c1ee7854c900 (diff)
BRT should return EOPNOTSUPP
Return the more descriptive EOPNOTSUPP instead of EXDEV when the storage pool doesn't support block cloning. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Kay Pedersen <[email protected]> Closes #15097
Diffstat (limited to 'module')
-rw-r--r--module/os/freebsd/zfs/zfs_vnops_os.c2
-rw-r--r--module/zfs/zfs_vnops.c16
2 files changed, 11 insertions, 7 deletions
diff --git a/module/os/freebsd/zfs/zfs_vnops_os.c b/module/os/freebsd/zfs/zfs_vnops_os.c
index 7692200ab..45cf6fdfc 100644
--- a/module/os/freebsd/zfs/zfs_vnops_os.c
+++ b/module/os/freebsd/zfs/zfs_vnops_os.c
@@ -6290,7 +6290,7 @@ zfs_freebsd_copy_file_range(struct vop_copy_file_range_args *ap)
error = zfs_clone_range(VTOZ(invp), ap->a_inoffp, VTOZ(outvp),
ap->a_outoffp, &len, ap->a_outcred);
- if (error == EXDEV)
+ if (error == EXDEV || error == EOPNOTSUPP)
goto bad_locked_fallback;
*ap->a_lenp = (size_t)len;
out_locked:
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
index 3ebd2d0ff..54ea43363 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -1078,6 +1078,16 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp,
return (SET_ERROR(EXDEV));
}
+ /*
+ * outos and inos belongs to the same storage pool.
+ * see a few lines above, only one check.
+ */
+ if (!spa_feature_is_enabled(dmu_objset_spa(outos),
+ SPA_FEATURE_BLOCK_CLONING)) {
+ zfs_exit_two(inzfsvfs, outzfsvfs, FTAG);
+ return (SET_ERROR(EOPNOTSUPP));
+ }
+
ASSERT(!outzfsvfs->z_replay);
error = zfs_verify_zp(inzp);
@@ -1088,12 +1098,6 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp,
return (error);
}
- if (!spa_feature_is_enabled(dmu_objset_spa(outos),
- SPA_FEATURE_BLOCK_CLONING)) {
- zfs_exit_two(inzfsvfs, outzfsvfs, FTAG);
- return (SET_ERROR(EXDEV));
- }
-
/*
* We don't copy source file's flags that's why we don't allow to clone
* files that are in quarantine.