Author: kib
Date: Sat Oct  2 16:04:50 2010
New Revision: 213359
URL: http://svn.freebsd.org/changeset/base/213359

Log:
  Release the vnode lock and close the linker file vnode earlier in
  the linker_load_file methods. The change is that the consequent
  linker_file_unload() call is not under the vnode lock anymore.
  This prevents the LOR between kernel linker sx xlock and vnode lock,
  because linker_file_unload() relocks kernel linker lock.
  
  MFC after:    2 weeks

Modified:
  head/sys/kern/link_elf.c
  head/sys/kern/link_elf_obj.c

Modified: head/sys/kern/link_elf.c
==============================================================================
--- head/sys/kern/link_elf.c    Sat Oct  2 11:45:18 2010        (r213358)
+++ head/sys/kern/link_elf.c    Sat Oct  2 16:04:50 2010        (r213359)
@@ -967,15 +967,15 @@ nosyms:
     *result = lf;
 
 out:
+    VOP_UNLOCK(nd.ni_vp, 0);
+    vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
+    VFS_UNLOCK_GIANT(vfslocked);
     if (error && lf)
        linker_file_unload(lf, LINKER_UNLOAD_FORCE);
     if (shdr)
        free(shdr, M_LINKER);
     if (firstpage)
        free(firstpage, M_LINKER);
-    VOP_UNLOCK(nd.ni_vp, 0);
-    vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
-    VFS_UNLOCK_GIANT(vfslocked);
 
     return error;
 }

Modified: head/sys/kern/link_elf_obj.c
==============================================================================
--- head/sys/kern/link_elf_obj.c        Sat Oct  2 11:45:18 2010        
(r213358)
+++ head/sys/kern/link_elf_obj.c        Sat Oct  2 16:04:50 2010        
(r213359)
@@ -885,13 +885,13 @@ link_elf_load_file(linker_class_t cls, c
        *result = lf;
 
 out:
+       VOP_UNLOCK(nd.ni_vp, 0);
+       vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
+       VFS_UNLOCK_GIANT(vfslocked);
        if (error && lf)
                linker_file_unload(lf, LINKER_UNLOAD_FORCE);
        if (hdr)
                free(hdr, M_LINKER);
-       VOP_UNLOCK(nd.ni_vp, 0);
-       vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
-       VFS_UNLOCK_GIANT(vfslocked);
 
        return error;
 }
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to