Call rctl_enforce() in all cases the resource usage goes up, even when called

from racct_*_force() functions.  It makes the "log" and "devctl" actions work
in those cases.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
trasz 2016-04-01 17:28:55 +00:00
parent 4f9a63f201
commit 02eee7b047

View File

@ -548,12 +548,10 @@ racct_add_locked(struct proc *p, int resource, uint64_t amount, int force)
PROC_LOCK_ASSERT(p, MA_OWNED);
#ifdef RCTL
if (!force) {
error = rctl_enforce(p, resource, amount);
if (error && RACCT_IS_DENIABLE(resource)) {
SDT_PROBE3(racct, , rusage, add__failure, p, resource, amount);
return (error);
}
error = rctl_enforce(p, resource, amount);
if (error && !force && RACCT_IS_DENIABLE(resource)) {
SDT_PROBE3(racct, , rusage, add__failure, p, resource, amount);
return (error);
}
#endif
racct_adjust_resource(p->p_racct, resource, amount);
@ -670,9 +668,9 @@ racct_set_locked(struct proc *p, int resource, uint64_t amount, int force)
resource));
#endif
#ifdef RCTL
if (!force && diff_proc > 0) {
if (diff_proc > 0) {
error = rctl_enforce(p, resource, diff_proc);
if (error && RACCT_IS_DENIABLE(resource)) {
if (error && !force && RACCT_IS_DENIABLE(resource)) {
SDT_PROBE3(racct, , rusage, set__failure, p, resource,
amount);
return (error);