mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Fix errno check, prevent spurious errors under heavy load
From man poll(2), poll does not set errno=EAGAIN on interrupt, however it does set errno=EINTR. Have libvirt retry on the appropriate errno. Under heavy load, a program of mine kept getting libvirt errors 'poll on socket failed: Interrupted system call'. The signals were SIGCHLD from processes forked by threads unrelated to those using libvirt.
This commit is contained in:
parent
d7d468f02c
commit
bfa74ebe1f
1
AUTHORS
1
AUTHORS
@ -253,6 +253,7 @@ Patches have also been contributed by:
|
||||
Ata E Husain Bohra <ata.husain@hotmail.com>
|
||||
Ján Tomko <jtomko@redhat.com>
|
||||
Richa Marwaha <rmarwah@linux.vnet.ibm.com>
|
||||
Peter Feiner <peter@gridcentric.ca>
|
||||
|
||||
[....send patches to get your name here....]
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* virnetclient.c: generic network RPC client
|
||||
*
|
||||
* Copyright (C) 2006-2011 Red Hat, Inc.
|
||||
* Copyright (C) 2006-2012 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -651,7 +651,7 @@ int virNetClientSetTLSSession(virNetClientPtr client,
|
||||
|
||||
repoll:
|
||||
ret = poll(fds, ARRAY_CARDINALITY(fds), -1);
|
||||
if (ret < 0 && errno == EAGAIN)
|
||||
if (ret < 0 && (errno == EAGAIN || errno == EINTR))
|
||||
goto repoll;
|
||||
|
||||
ignore_value(pthread_sigmask(SIG_BLOCK, &oldmask, NULL));
|
||||
@ -675,7 +675,7 @@ int virNetClientSetTLSSession(virNetClientPtr client,
|
||||
|
||||
repoll2:
|
||||
ret = poll(fds, ARRAY_CARDINALITY(fds), -1);
|
||||
if (ret < 0 && errno == EAGAIN)
|
||||
if (ret < 0 && (errno == EAGAIN || errno == EINTR))
|
||||
goto repoll2;
|
||||
|
||||
ignore_value(pthread_sigmask(SIG_BLOCK, &oldmask, NULL));
|
||||
@ -1374,7 +1374,7 @@ static int virNetClientIOEventLoop(virNetClientPtr client,
|
||||
|
||||
repoll:
|
||||
ret = poll(fds, ARRAY_CARDINALITY(fds), timeout);
|
||||
if (ret < 0 && errno == EAGAIN)
|
||||
if (ret < 0 && (errno == EAGAIN || errno == EINTR))
|
||||
goto repoll;
|
||||
|
||||
ignore_value(pthread_sigmask(SIG_SETMASK, &oldmask, NULL));
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* event.c: event loop for monitoring file handles
|
||||
*
|
||||
* Copyright (C) 2007, 2010-2011 Red Hat, Inc.
|
||||
* Copyright (C) 2007, 2010-2012 Red Hat, Inc.
|
||||
* Copyright (C) 2007 Daniel P. Berrange
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@ -615,7 +615,7 @@ int virEventPollRunOnce(void) {
|
||||
ret = poll(fds, nfds, timeout);
|
||||
if (ret < 0) {
|
||||
EVENT_DEBUG("Poll got error event %d", errno);
|
||||
if (errno == EINTR) {
|
||||
if (errno == EINTR || errno == EAGAIN) {
|
||||
goto retry;
|
||||
}
|
||||
virReportSystemError(errno, "%s",
|
||||
|
Loading…
x
Reference in New Issue
Block a user