Print this page
6940 Cannot unlink directories when over quota


2096         vnevent_rmdir(vp, dvp, name, ct);
2097 
2098         /*
2099          * Grab a lock on the directory to make sure that noone is
2100          * trying to add (or lookup) entries while we are removing it.
2101          */
2102         rw_enter(&zp->z_name_lock, RW_WRITER);
2103 
2104         /*
2105          * Grab a lock on the parent pointer to make sure we play well
2106          * with the treewalk and directory rename code.
2107          */
2108         rw_enter(&zp->z_parent_lock, RW_WRITER);
2109 
2110         tx = dmu_tx_create(zfsvfs->z_os);
2111         dmu_tx_hold_zap(tx, dzp->z_id, FALSE, name);
2112         dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE);
2113         dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL);
2114         zfs_sa_upgrade_txholds(tx, zp);
2115         zfs_sa_upgrade_txholds(tx, dzp);

2116         error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
2117         if (error) {
2118                 rw_exit(&zp->z_parent_lock);
2119                 rw_exit(&zp->z_name_lock);
2120                 zfs_dirent_unlock(dl);
2121                 VN_RELE(vp);
2122                 if (error == ERESTART) {
2123                         waited = B_TRUE;
2124                         dmu_tx_wait(tx);
2125                         dmu_tx_abort(tx);
2126                         goto top;
2127                 }
2128                 dmu_tx_abort(tx);
2129                 ZFS_EXIT(zfsvfs);
2130                 return (error);
2131         }
2132 
2133         error = zfs_link_destroy(dl, zp, tx, zflg, NULL);
2134 
2135         if (error == 0) {




2096         vnevent_rmdir(vp, dvp, name, ct);
2097 
2098         /*
2099          * Grab a lock on the directory to make sure that noone is
2100          * trying to add (or lookup) entries while we are removing it.
2101          */
2102         rw_enter(&zp->z_name_lock, RW_WRITER);
2103 
2104         /*
2105          * Grab a lock on the parent pointer to make sure we play well
2106          * with the treewalk and directory rename code.
2107          */
2108         rw_enter(&zp->z_parent_lock, RW_WRITER);
2109 
2110         tx = dmu_tx_create(zfsvfs->z_os);
2111         dmu_tx_hold_zap(tx, dzp->z_id, FALSE, name);
2112         dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE);
2113         dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL);
2114         zfs_sa_upgrade_txholds(tx, zp);
2115         zfs_sa_upgrade_txholds(tx, dzp);
2116         dmu_tx_mark_netfree(tx);
2117         error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
2118         if (error) {
2119                 rw_exit(&zp->z_parent_lock);
2120                 rw_exit(&zp->z_name_lock);
2121                 zfs_dirent_unlock(dl);
2122                 VN_RELE(vp);
2123                 if (error == ERESTART) {
2124                         waited = B_TRUE;
2125                         dmu_tx_wait(tx);
2126                         dmu_tx_abort(tx);
2127                         goto top;
2128                 }
2129                 dmu_tx_abort(tx);
2130                 ZFS_EXIT(zfsvfs);
2131                 return (error);
2132         }
2133 
2134         error = zfs_link_destroy(dl, zp, tx, zflg, NULL);
2135 
2136         if (error == 0) {