diff options
author | Chunwei Chen <[email protected]> | 2016-07-05 12:39:47 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-07-12 14:04:30 -0700 |
commit | ddae16a9cf0ba84fab4f7f4542efaf68dc87415b (patch) | |
tree | 5a5c671cdfb4341320d944afe69f8b394259a656 | |
parent | 6c2530647ce3f1fe92075b7ed96144fa3541d8f5 (diff) |
xattr dir doesn't get purged during iput
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]>
Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: Chris Dunlop <[email protected]>
Issue #4359
Issue #3508
Issue #4413
Issue #4827
-rw-r--r-- | module/zfs/zfs_dir.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/module/zfs/zfs_dir.c b/module/zfs/zfs_dir.c index bdcb87b94..50fa7e248 100644 --- a/module/zfs/zfs_dir.c +++ b/module/zfs/zfs_dir.c @@ -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); @@ -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); |