From 7a8f0e80eae9053ebe6a3c5ce5f3360e8df8de2f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 21 Jul 2014 10:19:25 -0700 Subject: zfs_trunc() should use dmu_tx_assign(tx, TXG_WAIT) As part of the write throttle & i/o schedule performance work the zfs_trunc() function should have been updated to use TXG_WAIT. Using TXG_WAIT ensures that the tx will be part of the next txg. If TXG_NOWAIT is used and retried for ERESTART errors then the tx can suffer from starvation. Signed-off-by: Brian Behlendorf Signed-off-by: Ned Bass Closes #2488 --- module/zfs/zfs_znode.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'module') diff --git a/module/zfs/zfs_znode.c b/module/zfs/zfs_znode.c index 23e090712..2d1ce93a7 100644 --- a/module/zfs/zfs_znode.c +++ b/module/zfs/zfs_znode.c @@ -1423,17 +1423,11 @@ zfs_trunc(znode_t *zp, uint64_t end) zfs_range_unlock(rl); return (error); } -top: tx = dmu_tx_create(zsb->z_os); dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE); zfs_sa_upgrade_txholds(tx, zp); - error = dmu_tx_assign(tx, TXG_NOWAIT); + error = dmu_tx_assign(tx, TXG_WAIT); if (error) { - if (error == ERESTART) { - dmu_tx_wait(tx); - dmu_tx_abort(tx); - goto top; - } dmu_tx_abort(tx); zfs_range_unlock(rl); return (error); -- cgit v1.2.3