jail: Fix a stray mutex from 76ad42abf9.

This commit is contained in:
Jamie Gritton 2021-01-18 15:47:09 -08:00
parent 098c902b52
commit 83bc72a04e

View File

@ -1119,7 +1119,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags)
if (tpr != pr && tpr->pr_ref > 0 &&
!strcmp(tpr->pr_name + pnamelen, namelc)) {
mtx_lock(&tpr->pr_mtx);
drflags |= PD_LOCKED;
if (prison_isalive(tpr)) {
if (pr == NULL &&
cuflags != JAIL_CREATE) {
@ -1128,6 +1127,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags)
* for updates.
*/
pr = tpr;
drflags |= PD_LOCKED;
break;
}
/*
@ -1136,6 +1136,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags)
* active sibling jail.
*/
error = EEXIST;
mtx_unlock(&tpr->pr_mtx);
vfs_opterror(opts,
"jail \"%s\" already exists",
name);
@ -1146,7 +1147,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags)
prison_isvalid(tpr))
deadpr = tpr;
mtx_unlock(&tpr->pr_mtx);
drflags &= ~PD_LOCKED;
}
}
/* If no active jail is found, use a dying one. */