Print this page
4347 ZPL can use dmu_tx_assign(TXG_WAIT)
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>

@@ -1467,11 +1467,10 @@
          */
         if (end <= zp->z_size) {
                 zfs_range_unlock(rl);
                 return (0);
         }
-top:
         tx = dmu_tx_create(zfsvfs->z_os);
         dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE);
         zfs_sa_upgrade_txholds(tx, zp);
         if (end > zp->z_blksz &&
             (!ISP2(zp->z_blksz) || zp->z_blksz < zfsvfs->z_max_blksz)) {

@@ -1487,18 +1486,13 @@
                 dmu_tx_hold_write(tx, zp->z_id, 0, newblksz);
         } else {
                 newblksz = 0;
         }
 
-        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);
         }
 
         if (newblksz)

@@ -1590,22 +1584,16 @@
         error = dmu_free_long_range(zfsvfs->z_os, zp->z_id, end,  -1);
         if (error) {
                 zfs_range_unlock(rl);
                 return (error);
         }
-top:
         tx = dmu_tx_create(zfsvfs->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);
         }
 
         zp->z_size = end;

@@ -1707,18 +1695,13 @@
                 return (error);
 log:
         tx = dmu_tx_create(zfsvfs->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 log;
-                }
-                dmu_tx_abort(tx);
                 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);