Remove Giant from init creation and vfs_mountroot.
Sponsored by: Netflix Discussed with: kib@, mckusick@ Differential Review: https://reviews.freebsd.org/D14712
This commit is contained in:
parent
30b3274fff
commit
d5292812f8
@ -703,10 +703,6 @@ start_init(void *dummy)
|
|||||||
struct thread *td;
|
struct thread *td;
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
|
|
||||||
mtx_lock(&Giant);
|
|
||||||
|
|
||||||
GIANT_REQUIRED;
|
|
||||||
|
|
||||||
TSENTER(); /* Here so we don't overlap with mi_startup. */
|
TSENTER(); /* Here so we don't overlap with mi_startup. */
|
||||||
|
|
||||||
td = curthread;
|
td = curthread;
|
||||||
@ -801,7 +797,6 @@ start_init(void *dummy)
|
|||||||
* to user mode as init!
|
* to user mode as init!
|
||||||
*/
|
*/
|
||||||
if ((error = sys_execve(td, &args)) == EJUSTRETURN) {
|
if ((error = sys_execve(td, &args)) == EJUSTRETURN) {
|
||||||
mtx_unlock(&Giant);
|
|
||||||
TSEXIT();
|
TSEXIT();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -268,13 +268,10 @@ sys_reboot(struct thread *td, struct reboot_args *uap)
|
|||||||
if (error == 0)
|
if (error == 0)
|
||||||
error = priv_check(td, PRIV_REBOOT);
|
error = priv_check(td, PRIV_REBOOT);
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
if (uap->opt & RB_REROOT) {
|
if (uap->opt & RB_REROOT)
|
||||||
error = kern_reroot();
|
error = kern_reroot();
|
||||||
} else {
|
else
|
||||||
mtx_lock(&Giant);
|
|
||||||
kern_reboot(uap->opt);
|
kern_reboot(uap->opt);
|
||||||
mtx_unlock(&Giant);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
@ -579,9 +579,7 @@ parse_dir_md(char **conf)
|
|||||||
|
|
||||||
if (root_mount_mddev != -1) {
|
if (root_mount_mddev != -1) {
|
||||||
mdio->md_unit = root_mount_mddev;
|
mdio->md_unit = root_mount_mddev;
|
||||||
DROP_GIANT();
|
|
||||||
error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio);
|
error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio);
|
||||||
PICKUP_GIANT();
|
|
||||||
/* Ignore errors. We don't care. */
|
/* Ignore errors. We don't care. */
|
||||||
root_mount_mddev = -1;
|
root_mount_mddev = -1;
|
||||||
}
|
}
|
||||||
@ -590,9 +588,7 @@ parse_dir_md(char **conf)
|
|||||||
mdio->md_options = MD_AUTOUNIT | MD_READONLY;
|
mdio->md_options = MD_AUTOUNIT | MD_READONLY;
|
||||||
mdio->md_mediasize = sb.st_size;
|
mdio->md_mediasize = sb.st_size;
|
||||||
mdio->md_unit = 0;
|
mdio->md_unit = 0;
|
||||||
DROP_GIANT();
|
|
||||||
error = kern_ioctl(td, fd, MDIOCATTACH, (void *)mdio);
|
error = kern_ioctl(td, fd, MDIOCATTACH, (void *)mdio);
|
||||||
PICKUP_GIANT();
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -601,9 +597,7 @@ parse_dir_md(char **conf)
|
|||||||
mdio->md_file = NULL;
|
mdio->md_file = NULL;
|
||||||
mdio->md_options = 0;
|
mdio->md_options = 0;
|
||||||
mdio->md_mediasize = 0;
|
mdio->md_mediasize = 0;
|
||||||
DROP_GIANT();
|
|
||||||
error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio);
|
error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio);
|
||||||
PICKUP_GIANT();
|
|
||||||
/* Ignore errors. We don't care. */
|
/* Ignore errors. We don't care. */
|
||||||
error = ERANGE;
|
error = ERANGE;
|
||||||
goto out;
|
goto out;
|
||||||
@ -960,9 +954,7 @@ vfs_mountroot_wait(void)
|
|||||||
|
|
||||||
curfail = 0;
|
curfail = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
DROP_GIANT();
|
|
||||||
g_waitidle();
|
g_waitidle();
|
||||||
PICKUP_GIANT();
|
|
||||||
mtx_lock(&root_holds_mtx);
|
mtx_lock(&root_holds_mtx);
|
||||||
if (LIST_EMPTY(&root_holds)) {
|
if (LIST_EMPTY(&root_holds)) {
|
||||||
mtx_unlock(&root_holds_mtx);
|
mtx_unlock(&root_holds_mtx);
|
||||||
@ -1004,9 +996,7 @@ vfs_mountroot_wait_if_neccessary(const char *fs, const char *dev)
|
|||||||
* Note that we must wait for GEOM to finish reconfiguring itself,
|
* Note that we must wait for GEOM to finish reconfiguring itself,
|
||||||
* eg for geom_part(4) to finish tasting.
|
* eg for geom_part(4) to finish tasting.
|
||||||
*/
|
*/
|
||||||
DROP_GIANT();
|
|
||||||
g_waitidle();
|
g_waitidle();
|
||||||
PICKUP_GIANT();
|
|
||||||
if (parse_mount_dev_present(dev))
|
if (parse_mount_dev_present(dev))
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
@ -1038,6 +1028,8 @@ vfs_mountroot(void)
|
|||||||
time_t timebase;
|
time_t timebase;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
mtx_assert(&Giant, MA_NOTOWNED);
|
||||||
|
|
||||||
TSENTER();
|
TSENTER();
|
||||||
|
|
||||||
td = curthread;
|
td = curthread;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user