Skip to content

Commit

Permalink
xattr dir doesn't get purged during iput
Browse files Browse the repository at this point in the history
We need to set inode->i_nlink to zero so iput will purge it. Without this, it
will get purged during shrink cache or umount, which would likely result in
deadlock due to zfs_zget waiting forever on its children which are in the
dispose_list of the same thread.

Signed-off-by: Chunwei Chen <[email protected]>
  • Loading branch information
Chunwei Chen committed Jul 5, 2016
1 parent 5c27b29 commit 2ec87c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion module/zfs/zfs_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ zfs_purgedir(znode_t *dzp)
if (error)
skipped += 1;
dmu_tx_commit(tx);

set_nlink(ZTOI(xzp), xzp->z_links);
zfs_iput_async(ZTOI(xzp));
}
zap_cursor_fini(&zc);
Expand Down Expand Up @@ -695,6 +695,7 @@ zfs_rmnode(znode_t *zp)
mutex_enter(&xzp->z_lock);
xzp->z_unlinked = B_TRUE; /* mark xzp for deletion */
xzp->z_links = 0; /* no more links to it */
set_nlink(ZTOI(xzp), 0); /* this will let iput purge us */
VERIFY(0 == sa_update(xzp->z_sa_hdl, SA_ZPL_LINKS(zsb),
&xzp->z_links, sizeof (xzp->z_links), tx));
mutex_exit(&xzp->z_lock);
Expand Down

0 comments on commit 2ec87c0

Please sign in to comment.