Searched hist:223061 (Results 1 - 1 of 1) sorted by relevance

/freebsd-10.1-release/sys/kern/
H A Dsubr_devstat.cdiff 223061 Mon Jun 13 19:30:07 MDT 2011 gibbs Fix a couple of race conditions in devstat(9) initialization.

In devstat_new_entry(), there is no need to initialize the queue
and the mutex in this function. There are ways to do static
initialization on both, so use STAILQ_HEAD_INITIALIZER and
MTX_SYSINIT to initialize the queue and the mutex.

In devstat_alloc(), use an atomic test and set routine to guard
making our entry in /dev. Using just a plain static variable
creates a race condition on multiprocessor machines. If you
attempt to create a second entry in devfs, the kernel will panic.

Submitted by: kdm
Reviewed by: gibbs
Sponsored by: Spectra Logic Corporation
MFC after: 1 week.

Completed in 111 milliseconds