Skip to content

Commit

Permalink
Revert "Revert "Revert "Fix unlink/xattr deadlock"""
Browse files Browse the repository at this point in the history
This reverts commit 7973e46. That had
been intended to workaround a deadlock issue involving zfs_zget(), which
was fixed by 6f9548c. The workaround
had the side effect of causing zfs_zinactive() to cause excessive cpu
utilization in zfs_iput_taskq by queuing an iteration of all objects in
a dataset on every unlink on a directory that had extended attributes.
That resulted in many issue reports about iput_taskq spinning. Since the
original rationale for the change is no longer valid, we can safely
revert it to resolve all of those issue reports.

Conflicts:
	module/zfs/zfs_dir.c

Closes:
	openzfs#457
	openzfs#2058
	openzfs#2128
	openzfs#2240
  • Loading branch information
ryao committed Jun 27, 2014
1 parent 247fb38 commit ae022b6
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions module/zfs/zfs_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,6 @@ zfs_rmnode(znode_t *zp)
dmu_tx_t *tx;
uint64_t acl_obj;
uint64_t xattr_obj;
uint64_t count;
int error;

ASSERT(zp->z_links == 0);
Expand All @@ -633,27 +632,13 @@ zfs_rmnode(znode_t *zp)
* If this is an attribute directory, purge its contents.
*/
if (S_ISDIR(ZTOI(zp)->i_mode) && (zp->z_pflags & ZFS_XATTR)) {
error = zap_count(os, zp->z_id, &count);
if (error) {
zfs_znode_dmu_fini(zp);
return;
}

if (count > 0) {
taskq_t *taskq;

if (zfs_purgedir(zp) != 0) {
/*
* There are still directory entries in this xattr
* directory. Let zfs_unlinked_drain() deal with
* them to avoid deadlocking this process in the
* zfs_purgedir()->zfs_zget()->ilookup() callpath
* on the xattr inode's I_FREEING bit.
* Not enough space to delete some xattrs.
* Leave it in the unlinked set.
*/
taskq = dsl_pool_iput_taskq(dmu_objset_pool(os));
taskq_dispatch(taskq, (task_func_t *)
zfs_unlinked_drain, zsb, TQ_SLEEP);

zfs_znode_dmu_fini(zp);

return;
}
}
Expand Down

0 comments on commit ae022b6

Please sign in to comment.