sysctl: don't modify oid_running for static nodes
It is necessary to prevent nodes from being destroyed while used, but static ones cannot be destroyed.
This commit is contained in:
parent
2993dfad1d
commit
1fcfd71f4d
@ -174,7 +174,8 @@ sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1, intptr_t arg2,
|
||||
int error;
|
||||
bool xlocked;
|
||||
|
||||
atomic_add_int(&oid->oid_running, 1);
|
||||
if (oid->oid_kind & CTLFLAG_DYN)
|
||||
atomic_add_int(&oid->oid_running, 1);
|
||||
xlocked = sysctl_unlock();
|
||||
|
||||
if (!(oid->oid_kind & CTLFLAG_MPSAFE))
|
||||
@ -184,9 +185,11 @@ sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1, intptr_t arg2,
|
||||
mtx_unlock(&Giant);
|
||||
|
||||
sysctl_lock(xlocked);
|
||||
if (atomic_fetchadd_int(&oid->oid_running, -1) == 1 &&
|
||||
(oid->oid_kind & CTLFLAG_DYING) != 0)
|
||||
wakeup(&oid->oid_running);
|
||||
if (oid->oid_kind & CTLFLAG_DYN) {
|
||||
if (atomic_fetchadd_int(&oid->oid_running, -1) == 1 &&
|
||||
(oid->oid_kind & CTLFLAG_DYING) != 0)
|
||||
wakeup(&oid->oid_running);
|
||||
}
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user