Skip to content

Commit

Permalink
EOPNOTSUPP more speaking return value:
Browse files Browse the repository at this point in the history
return EOPNOTSUPP if the storage pool don't support block cloning.

Signed-off-by: Kay Pedersen <mail@mkwg.de>
  • Loading branch information
oromenahar committed Jul 22, 2023
1 parent 2d8a2b5 commit 2fdca62
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions module/zfs/zfs_vnops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* 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);
Expand All @@ -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.
Expand Down

0 comments on commit 2fdca62

Please sign in to comment.