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 17:55:30 +0000 (09:55 -0800)
commitc3b758f6fe8b7ae5e3e0204236f6aba48d714bc1
tree4bbda57af783cc0830633bbe6bb7a5bf43ca052a
parent1fe4c0a0ca8a04a0fd830fea4e565cc39a58e584
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