[libvirt] [PATCH] virlog: add log lock in virLogSetDefaultPriority

When the global variable virLogDefaultPriority is modified, it will be better to have a lock. Signed-off-by: Zhou Yimin <zhouyimin@huawei.com> --- src/util/virlog.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/virlog.c b/src/util/virlog.c index 68af0f3..ba370e2 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -498,7 +498,10 @@ virLogSetDefaultPriority(virLogPriority priority) if (virLogInitialize() < 0) return -1; + virLogLock(); virLogDefaultPriority = priority; + virLogUnlock(); + return 0; } -- 1.7.12.4

On 17.03.2014 13:30, Wangrui (K) wrote:
When the global variable virLogDefaultPriority is modified, it will
be better to have a lock.
Signed-off-by: Zhou Yimin <zhouyimin@huawei.com>
---
Is there any specific behavior you are seeing? There's nothing wrong with the patch, but as far as I know Dan is trying to kill the log lock. Michal

On Mon, Mar 17, 2014 at 01:59:06PM +0100, Michal Privoznik wrote:
On 17.03.2014 13:30, Wangrui (K) wrote:
When the global variable virLogDefaultPriority is modified, it will
be better to have a lock.
Signed-off-by: Zhou Yimin <zhouyimin@huawei.com>
---
Is there any specific behavior you are seeing? There's nothing wrong with the patch, but as far as I know Dan is trying to kill the log lock.
Adding this particular lock is ok. The situation should be harmless though, since this function is only called in single-threaded contexts I believe. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (3)
-
Daniel P. Berrange
-
Michal Privoznik
-
Wangrui (K)