mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
hwpmc: on process exit, ensure that the owned log is closed
Tested by: pho (previous version) Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41521
This commit is contained in:
parent
1fd8c845b8
commit
3c872a70b8
1 changed files with 5 additions and 3 deletions
|
|
@ -4989,13 +4989,13 @@ pmc_process_exit(void *arg __unused, struct proc *p)
|
|||
}
|
||||
PMC_EPOCH_EXIT();
|
||||
|
||||
if (!is_using_hwpmcs)
|
||||
return;
|
||||
|
||||
PMC_GET_SX_XLOCK();
|
||||
PMCDBG3(PRC,EXT,1,"process-exit proc=%p (%d, %s)", p, p->p_pid,
|
||||
p->p_comm);
|
||||
|
||||
if (!is_using_hwpmcs)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Since this code is invoked by the last thread in an exiting process,
|
||||
* we would have context switched IN at some prior point. However, with
|
||||
|
|
@ -5116,6 +5116,8 @@ out:
|
|||
* If the process owned PMCs, free them up and free up memory.
|
||||
*/
|
||||
if ((po = pmc_find_owner_descriptor(p)) != NULL) {
|
||||
if ((po->po_flags & PMC_PO_OWNS_LOGFILE) != 0)
|
||||
pmclog_close(po);
|
||||
pmc_remove_owner(po);
|
||||
pmc_destroy_owner_descriptor(po);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue