svn commit: r211896 - head/sbin/hastd
kostikbel at gmail.com
Sat Aug 28 08:44:00 UTC 2010
On Fri, Aug 27, 2010 at 11:54:02PM +0200, Pawel Jakub Dawidek wrote:
> On Sat, Aug 28, 2010 at 12:38:27AM +0300, Kostik Belousov wrote:
> > > --- head/sbin/hastd/primary.c Fri Aug 27 20:48:12 2010 (r211895)
> > > +++ head/sbin/hastd/primary.c Fri Aug 27 20:49:06 2010 (r211896)
> > > @@ -1988,7 +1988,9 @@ guard_thread(void *arg)
> > > rw_unlock(&hio_remote_lock[ii]);
> > > }
> > > }
> > > - (void)cv_timedwait(&hio_guard_cond, &hio_guard_lock, timeout);
> > > + /* Sleep only if a signal wasn't delivered in the meantime. */
> > > + if (!sigexit_received && !sighup_received && !sigchld_received)
> > > + cv_timedwait(&hio_guard_cond, &hio_guard_lock, timeout);
> > > mtx_unlock(&hio_guard_lock);
> > > }
> > > /* NOTREACHED */
> > I wanted to say that this is racy, because if a signal is delivered after
> > the check is done but before the sleep, you loose.
> Yes, I know it is racy, but the race isn't critical anymore, as we will
> eventually wait at most 10 seconds to handle signals.
> > After looking at the signal handler, I noted that you call not async-safe
> > functions in the handler. This is easy way to get undefined behaviour,
> > i.e. probably crash. And wakeup from the handler would have the same
> > race as sigXXX_received check.
> Which aren't async-safe? pthread stuff?
Yes. All pthread_* namespace is not async-signal safe.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20100828/986aeb8d/attachment.pgp
More information about the svn-src-all