Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jun 2011 21:21:02 +0000 (UTC)
From:      "Justin T. Gibbs" <gibbs@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/sys/kern subr_devstat.c
Message-ID:  <201106132121.p5DLLRNw035398@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
gibbs       2011-06-13 21:21:02 UTC

  FreeBSD src repository

  Modified files:
    sys/kern             subr_devstat.c 
  Log:
  SVN rev 223061 on 2011-06-13 21:21:02Z by 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.
  
  Revision  Changes    Path
  1.57      +3 -9      src/sys/kern/subr_devstat.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106132121.p5DLLRNw035398>