Add missing checks to zfs_clone_range_replay()

zfs_clone_range() does a few error checks that we are missing in
zfs_clone_range_replay().

Reported-by: Grok 4.5 Build Beta
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #18867
This commit is contained in:
Richard Yao authored and GitHub committed 2026-07-31 13:03:38 -07:00
1 parent 412b17a29a
commit b5bb1f8161
1 file changed
+14 -2
+14 -2
View File
@@ -1959,7 +1959,7 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp,
/*
* Block growth may fail for many reasons we can not
* predict here. If it happen the cloning is doomed.
* predict here. If it happens, the cloning is doomed.
*/
if (inblksz != outzp->z_blksz) {
error = SET_ERROR(EINVAL);
@@ -2117,7 +2117,19 @@ zfs_clone_range_replay(znode_t *zp, uint64_t off, uint64_t len, uint64_t blksz,
if (zp->z_blksz < blksz)
zfs_grow_blocksize(zp, blksz, tx);
dmu_brt_clone(zfsvfs->z_os, zp->z_id, off, len, tx, bps, nbps);
if (blksz != zp->z_blksz) {
error = SET_ERROR(EINVAL);
dmu_tx_commit(tx);
zfs_exit(zfsvfs, FTAG);
return (error);
}
error = dmu_brt_clone(zfsvfs->z_os, zp->z_id, off, len, tx, bps, nbps);
if (error != 0) {
dmu_tx_commit(tx);
zfs_exit(zfsvfs, FTAG);
return (error);
}
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MTIME(zfsvfs), NULL, &mtime, 16);
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL, &ctime, 16);