vlog: Fix a deadlock bug.
authorAndy Zhou <azhou@von.org>
Sat, 14 Nov 2015 02:39:37 +0000 (18:39 -0800)
committerAndy Zhou <azhou@ovn.org>
Thu, 19 Nov 2015 21:13:20 +0000 (13:13 -0800)
commite9d6808ca6bfeb6b8d1ca30113c186098e4d2d56
tree4f8c0c7024e1d5cb7d439cff6335a04e66126493
parent10d8e9c6719530a317dfe657442b10023f2aec5d
vlog: Fix a deadlock bug.

Calling VLOG_FATAL() while holding the 'log_file_mutex" may lead to
deadlock since VLOG_FATAL() implementation tries to acquire the
same lock. Fix this by building the error message first, then
call VLOG_FATAL() after the 'log_file_mutex' has been released.

This bug is not likely show up in practice since chown() usually
won't fail. It is still better to have a correct implementation.

Reported-by: Daniele Di Proietto <ddiproietto@vmware.com>
Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Daniele Di Proietto <ddiproietto@vmware.com>
lib/vlog.c