summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2013-10-08 15:24:00 -0700
committerGreg Farnum <greg@inktank.com>2013-10-14 11:14:44 -0700
commit6641273b19914a3af098bb3005724bec481e6ce3 (patch)
treeb38655b376f71c1d0d51bb1354db5086f95f42b2
parent2cc5805a14aeb22e6747a9daba63c55a23d09798 (diff)
downloadceph-6641273b19914a3af098bb3005724bec481e6ce3.tar.gz
SignalHandler: fix infinite loop on BSD systems
SignalHandler::entry shouldn't poll for POLLOUT, because it never actually writes to the pipes in question. Polling for POLLOUT causes poll(2) to immediately return, so the function spins the CPU and never blocks. Remove the POLLOUT flag, unnecessarily introduced in commit 8e4a78f169eda716c7d6811cb6db5c757dc67207 when switching from select() to poll(). This fixes the problem on FreeBSD and doesn't break anything (AFAICT) on Linux. Tested on FreeBSD 9.1 amd64 and Ubuntu Server 13.04 amd64. Fixes: #6492 Signed-off-by: Alan Somers <asomers@gmail.com> Reviewed-by: Greg Farnum <greg@inktank.com>
-rw-r--r--src/global/signal_handler.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/global/signal_handler.cc b/src/global/signal_handler.cc
index ce604fe1e5d..ffdc5402caf 100644
--- a/src/global/signal_handler.cc
+++ b/src/global/signal_handler.cc
@@ -196,13 +196,13 @@ struct SignalHandler : public Thread {
lock.Lock();
int num_fds = 0;
fds[num_fds].fd = pipefd[0];
- fds[num_fds].events = POLLIN | POLLOUT | POLLERR;
+ fds[num_fds].events = POLLIN | POLLERR;
fds[num_fds].revents = 0;
++num_fds;
for (unsigned i=0; i<32; i++) {
if (handlers[i]) {
fds[num_fds].fd = handlers[i]->pipefd[0];
- fds[num_fds].events = POLLIN | POLLOUT | POLLERR;
+ fds[num_fds].events = POLLIN | POLLERR;
fds[num_fds].revents = 0;
++num_fds;
}