[libvirt] [PATCH 1/2] Avoid taking lock in libvirt debug dump
Eric Blake
eblake at redhat.com
Thu Mar 17 23:19:59 UTC 2011
On 03/17/2011 01:41 AM, Daniel Veillard wrote:
> As pointed out, locking the buffer from the signal handler
> cannot been garanteed to be safe, so to avoid any hazard
s/garanteed/guaranteed/
> we prefer the trade off of dumping logs possibly messed up
> by concurrent logging activity rather than risk a daemon
> crash.
>
> * src/util/logging.c: change virLogEmergencyDumpAll() to not
> take any lock on the log buffer but reset buffer content variables
> + /*
> + * Since we can't lock the buffer safely from a signal handler
> + * we mark it as empty in case of concurrent access, and proceed
> + * with the data, at worse we will output something a bit weird
> + * if another thread start logging messages at the same time.
> + * Note that virLogStr() uses virLogEnd for the computations and
> + * writes to the buffer and then only update virLogLen and virLogStart
s/then only update/only then updates/
ACK with those nits fixed.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110317/8ea58e77/attachment-0001.sig>
More information about the libvir-list
mailing list