summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2005-05-03 10:55:05 +0000
committerjeff <jeff@FreeBSD.org>2005-05-03 10:55:05 +0000
commitab437d7b1d8f98510d760db5f67247fd94a028d9 (patch)
treeb43d8453f35fe1bec02a0f06140e292aca3157bd
parent451e14446f914bff6d118da3d71fa31501ba406c (diff)
downloadFreeBSD-src-ab437d7b1d8f98510d760db5f67247fd94a028d9.zip
FreeBSD-src-ab437d7b1d8f98510d760db5f67247fd94a028d9.tar.gz
- Use namei to acquire Giant for VFS if it is necessary. Drop the explicit
Giant acquisition. - Remove GIANT_REQUIRED in the few remaining cases; the vm and vfs have both been locked.
-rw-r--r--sys/kern/kern_exec.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 49b3868..2e13bb0 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -294,6 +294,7 @@ do_execve(td, args, mac_p)
#endif
struct vnode *textvp = NULL;
int credential_changing;
+ int vfslocked;
int textset;
#ifdef MAC
struct label *interplabel = NULL;
@@ -348,16 +349,16 @@ do_execve(td, args, mac_p)
* in ni_vp amoung other things.
*/
ndp = &nd;
- NDINIT(ndp, LOOKUP, ISOPEN | LOCKLEAF | FOLLOW | SAVENAME,
+ NDINIT(ndp, LOOKUP, ISOPEN | LOCKLEAF | FOLLOW | SAVENAME | MPSAFE,
UIO_SYSSPACE, args->fname, td);
- mtx_lock(&Giant);
interpret:
-
+ vfslocked = 0;
error = namei(ndp);
if (error)
goto exec_fail;
+ vfslocked = NDHASGIANT(ndp);
imgp->vp = ndp->ni_vp;
/*
@@ -438,8 +439,9 @@ interpret:
vput(ndp->ni_vp);
vm_object_deallocate(imgp->object);
imgp->object = NULL;
+ VFS_UNLOCK_GIANT(vfslocked);
/* set new name to that of the interpreter */
- NDINIT(ndp, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME,
+ NDINIT(ndp, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME | MPSAFE,
UIO_SYSSPACE, imgp->interpreter_name, td);
goto interpret;
}
@@ -772,7 +774,7 @@ done2:
if (interplabel != NULL)
mac_vnode_label_free(interplabel);
#endif
- mtx_unlock(&Giant);
+ VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
@@ -785,8 +787,6 @@ exec_map_first_page(imgp)
vm_page_t ma[VM_INITIAL_PAGEIN];
vm_object_t object;
- GIANT_REQUIRED;
-
if (imgp->firstpage != NULL)
exec_unmap_first_page(imgp);
@@ -876,8 +876,6 @@ exec_new_vmspace(imgp, sv)
vm_offset_t stack_addr;
vm_map_t map;
- GIANT_REQUIRED;
-
imgp->vmspace_destroyed = 1;
/* Called with Giant held, do not depend on it! */
OpenPOWER on IntegriCloud