svn commit: r211896 - head/sbin/hastd
kostikbel at gmail.com
Fri Aug 27 21:38:33 UTC 2010
On Fri, Aug 27, 2010 at 08:49:06PM +0000, Pawel Jakub Dawidek wrote:
> Author: pjd
> Date: Fri Aug 27 20:49:06 2010
> New Revision: 211896
> URL: http://svn.freebsd.org/changeset/base/211896
> Check if no signals were delivered just before going to sleep.
> MFC after: 2 weeks
> Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
> Modified: head/sbin/hastd/primary.c
> --- 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)
> - (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);
> /* 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.
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.
-------------- 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/20100827/a5d34638/attachment.pgp
More information about the svn-src-all