Print this page
6334 Cannot unlink files when over quota


1717 
1718         /* are there any extended attributes? */
1719         error = sa_lookup(zp->z_sa_hdl, SA_ZPL_XATTR(zfsvfs),
1720             &xattr_obj, sizeof (xattr_obj));
1721         if (error == 0 && xattr_obj) {
1722                 error = zfs_zget(zfsvfs, xattr_obj, &xzp);
1723                 ASSERT0(error);
1724                 dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_TRUE);
1725                 dmu_tx_hold_sa(tx, xzp->z_sa_hdl, B_FALSE);
1726         }
1727 
1728         mutex_enter(&zp->z_lock);
1729         if ((acl_obj = zfs_external_acl(zp)) != 0 && may_delete_now)
1730                 dmu_tx_hold_free(tx, acl_obj, 0, DMU_OBJECT_END);
1731         mutex_exit(&zp->z_lock);
1732 
1733         /* charge as an update -- would be nice not to charge at all */
1734         dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL);
1735 
1736         /*
1737          * Mark this transaction as typically resulting in a net free of
1738          * space, unless object removal will be delayed indefinitely
1739          * (due to active holds on the vnode due to the file being open).
1740          */
1741         if (may_delete_now)
1742                 dmu_tx_mark_netfree(tx);
1743 
1744         error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
1745         if (error) {
1746                 zfs_dirent_unlock(dl);
1747                 VN_RELE(vp);
1748                 if (xzp)
1749                         VN_RELE(ZTOV(xzp));
1750                 if (error == ERESTART) {
1751                         waited = B_TRUE;
1752                         dmu_tx_wait(tx);
1753                         dmu_tx_abort(tx);
1754                         goto top;
1755                 }
1756                 if (realnmp)
1757                         pn_free(realnmp);
1758                 dmu_tx_abort(tx);
1759                 ZFS_EXIT(zfsvfs);
1760                 return (error);
1761         }




1717 
1718         /* are there any extended attributes? */
1719         error = sa_lookup(zp->z_sa_hdl, SA_ZPL_XATTR(zfsvfs),
1720             &xattr_obj, sizeof (xattr_obj));
1721         if (error == 0 && xattr_obj) {
1722                 error = zfs_zget(zfsvfs, xattr_obj, &xzp);
1723                 ASSERT0(error);
1724                 dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_TRUE);
1725                 dmu_tx_hold_sa(tx, xzp->z_sa_hdl, B_FALSE);
1726         }
1727 
1728         mutex_enter(&zp->z_lock);
1729         if ((acl_obj = zfs_external_acl(zp)) != 0 && may_delete_now)
1730                 dmu_tx_hold_free(tx, acl_obj, 0, DMU_OBJECT_END);
1731         mutex_exit(&zp->z_lock);
1732 
1733         /* charge as an update -- would be nice not to charge at all */
1734         dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL);
1735 
1736         /*
1737          * Mark this transaction as typically resulting in a net free of space


1738          */

1739         dmu_tx_mark_netfree(tx);
1740 
1741         error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
1742         if (error) {
1743                 zfs_dirent_unlock(dl);
1744                 VN_RELE(vp);
1745                 if (xzp)
1746                         VN_RELE(ZTOV(xzp));
1747                 if (error == ERESTART) {
1748                         waited = B_TRUE;
1749                         dmu_tx_wait(tx);
1750                         dmu_tx_abort(tx);
1751                         goto top;
1752                 }
1753                 if (realnmp)
1754                         pn_free(realnmp);
1755                 dmu_tx_abort(tx);
1756                 ZFS_EXIT(zfsvfs);
1757                 return (error);
1758         }