Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
Fix invalid context bug
Browse files Browse the repository at this point in the history
In the module unload path the vm_file_cache was being destroyed
under a spin lock.  Because this operation might sleep it was
possible, although very very unlikely, that this could result
in a deadlock.

This issue was indentified by using a Linux debug kernel and
has been fixed by moving the kmem_cache_destroy() out from under
the spin lock.  There is no need to lock this operation here.

Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs/zfs#771
  • Loading branch information
behlendorf committed Jun 11, 2012
1 parent 93b0dc9 commit 2371321
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions module/spl/spl-vnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,13 +845,12 @@ spl_vn_fini(void)
leaked++;
}

kmem_cache_destroy(vn_file_cache);
vn_file_cache = NULL;
spin_unlock(&vn_file_lock);

if (leaked > 0)
SWARN("Warning %d files leaked\n", leaked);

kmem_cache_destroy(vn_file_cache);
kmem_cache_destroy(vn_cache);

SEXIT;
Expand Down

0 comments on commit 2371321

Please sign in to comment.