Make TX abort after assign safer

It is not right, but there are few examples when TX is aborted
after being assigned in case of error.  To handle it better on
production systems add extra cleanup steps.

While here, replace couple dmu_tx_abort() in simple cases.

Reviewed-by: Rob Norris <robn@despairlabs.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #17438
This commit is contained in:
Alexander Motin 2025-06-10 12:30:06 -04:00 committed by Alexander Motin
parent 809b553940
commit 22eb2bdce3

View File

@ -1163,7 +1163,7 @@ zfs_rewrite(znode_t *zp, uint64_t off, uint64_t len, uint64_t flags,
error = dmu_buf_hold_array_by_dnode(dn, off, n, TRUE, FTAG,
&numbufs, &dbp, DMU_READ_PREFETCH);
if (error) {
dmu_tx_abort(tx);
dmu_tx_commit(tx);
break;
}
for (int i = 0; i < numbufs; i++) {