]> granicus.if.org Git - spl/commitdiff
Fix invalid context bug
authorBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 11 Jun 2012 16:12:37 +0000 (09:12 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 11 Jun 2012 16:17:45 +0000 (09:17 -0700)
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 <behlendorf1@llnl.gov>
Closes zfsonlinux/zfs#771

module/spl/spl-vnode.c

index cd0fa2cd1eb83fbc35a5ff607645c232c2891f86..2e55b007b506b203d15b189eabe730b71d44fac2 100644 (file)
@@ -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;