mirror of
https://github.com/opnsense/src.git
synced 2026-04-23 07:07:24 -04:00
pmc: avoid potential race on shutdown
Clear shutdown flag first, conservatively allow 5ms for all hardclock consumers to see flag before drainining
This commit is contained in:
parent
6cff19a3be
commit
f2daab2c8f
1 changed files with 8 additions and 6 deletions
|
|
@ -872,18 +872,20 @@ pmclog_close(struct pmc_owner *po)
|
|||
pmclog_process_closelog(po);
|
||||
|
||||
mtx_lock(&pmc_kthread_mtx);
|
||||
|
||||
/*
|
||||
* Initiate shutdown: no new data queued,
|
||||
* thread will close file on last block.
|
||||
*/
|
||||
po->po_flags |= PMC_PO_SHUTDOWN;
|
||||
/* give time for all to see */
|
||||
DELAY(50);
|
||||
|
||||
/*
|
||||
* Schedule the current buffer.
|
||||
*/
|
||||
pmclog_schedule_all(po);
|
||||
wakeup_one(po);
|
||||
|
||||
/*
|
||||
* Initiate shutdown: no new data queued,
|
||||
* thread will close file on last block.
|
||||
*/
|
||||
po->po_flags |= PMC_PO_SHUTDOWN;
|
||||
mtx_unlock(&pmc_kthread_mtx);
|
||||
|
||||
return (0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue