When retrieving the current per-jails securelevel for a sysctl read,

don't acquire the prison mutex, as it's an integer read and races
here don't make a difference.

MFC after:	1 week
This commit is contained in:
rwatson 2005-01-23 20:59:19 +00:00
parent 4af1a370c8
commit 293a12c083

View File

@ -251,13 +251,12 @@ sysctl_kern_securelvl(SYSCTL_HANDLER_ARGS)
/*
* If the process is in jail, return the maximum of the global and
* local levels; otherwise, return the global level.
* local levels; otherwise, return the global level. Perform a
* lockless read since the securelevel is an interger.
*/
if (pr != NULL) {
mtx_lock(&pr->pr_mtx);
if (pr != NULL)
level = imax(securelevel, pr->pr_securelevel);
mtx_unlock(&pr->pr_mtx);
} else
else
level = securelevel;
error = sysctl_handle_int(oidp, &level, 0, req);
if (error || !req->newptr)