vlog: Avoid deadlock in vlog_init__() corner case.
authorBen Pfaff <blp@nicira.com>
Fri, 6 Dec 2013 00:59:13 +0000 (16:59 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 21 Jan 2014 18:00:54 +0000 (10:00 -0800)
commit7c3968eea4986d745f636ba61fb7d05fb1952a03
tree46eef0c8a1d10053d6d8748af17e35992ca07e16
parent3d020f4134abfe9837898ed7b98981239e9b3ab0
vlog: Avoid deadlock in vlog_init__() corner case.

Anything inside vlog_init__() that tried to log a message was going to
deadlock, since it would hit pthread_once() recursively and wait for the
previous call to complete.  Unfortunately, there was a VLOG_ERR call inside
vlog_init__(), only called in the corner case where the system's clock was
wrong.

This fixes the problem by rearranging code so that the logging isn't
inside the "once-only" region.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/vlog.c