svn commit: r256454 - projects/zfsd/head/cddl/sbin/zfsd
Alan Somers
asomers at FreeBSD.org
Mon Oct 14 20:59:18 UTC 2013
Author: asomers
Date: Mon Oct 14 20:59:17 2013
New Revision: 256454
URL: http://svnweb.freebsd.org/changeset/base/256454
Log:
Remove information about devd reconnection policies that was distributed within
comments and syslog() strings in functions well below where these decisions are
made.
stable/cddl/sbin/zfsd/zfsd.cc:
o In ZfsDaemon::DisconnectFromDevd(), log when the
connection is torn down. This removes the need to
guess that this will happen in comments or log strings
in code that all eventually sends us to this function.
o In ZfsDaemon::EventsPending(), treat poll returning
-1 with an errno other than EINTR, or 0 as a program
terminating event just as it is in the other case
where we invoke poll. These events indicate poll or
our code is seriously broken.
o In ZfsDaemon::EventsPending(), prioritize emitting
a POLLERR event over POLLHUP in case they are both
set. POLLHUP is benign, but POLLERR may indicate
something we need to investigate.
o In ZfsDaemon::EventLoop(), remove comments and log
strings that claim knowledge of policy implemented
in EventLoop's caller, ZfsDaemon::Run().
Submitted by: gibbs
Approved by: ken (mentor)
Obtained from: Spectra Logic Corporation
Modified:
projects/zfsd/head/cddl/sbin/zfsd/zfsd.cc
Modified: projects/zfsd/head/cddl/sbin/zfsd/zfsd.cc
==============================================================================
--- projects/zfsd/head/cddl/sbin/zfsd/zfsd.cc Mon Oct 14 20:56:51 2013 (r256453)
+++ projects/zfsd/head/cddl/sbin/zfsd/zfsd.cc Mon Oct 14 20:59:17 2013 (r256454)
@@ -450,6 +450,9 @@ ZfsDaemon::ConnectToDevd()
void
ZfsDaemon::DisconnectFromDevd()
{
+ if (s_devdSockFD != -1)
+ syslog(LOG_INFO, "Disconnecting from devd.");
+
delete s_reader;
s_reader = NULL;
close(s_devdSockFD);
@@ -520,25 +523,19 @@ ZfsDaemon::EventsPending()
result = poll(fds, NUM_ELEMENTS(fds), /*timeout*/0);
} while (result == -1 && errno == EINTR);
- if (result == -1) {
- /* Unexpected error; try reconnecting the socket */
- throw ZfsdException("ZfsdDaemon::EventsPending(): "
- "Unexpected error from poll()");
- }
+ if (result == -1)
+ err(1, "Polling for devd events failed");
- if ((fds->revents & POLLHUP) != 0) {
- /*
- * The other end hung up the socket. Throw an exception
- * so ZfsDaemon will try to reconnect
- */
- throw ZfsdException("ZfsDaemon::EventsPending(): Got POLLHUP");
- }
+ if (result == 0)
+ errx(1, "Unexpected result of 0 from poll. Exiting");
- if ((fds->revents & POLLERR) != 0) {
- /* Try reconnecting. */
- throw ZfsdException("ZfsdDaemon:EventsPending(): Got POLLERR. "
- " Reconnecting.");
- }
+ if ((fds->revents & POLLERR) != 0)
+ throw ZfsdException("ZfsdDaemon:EventsPending(): "
+ "POLLERR detected on devd socket.");
+
+ if ((fds->revents & POLLHUP) != 0)
+ throw ZfsdException("ZfsDaemon::EventsPending(): "
+ "POLLHUP detected on devd socket.");
return ((fds->revents & POLLIN) != 0);
}
@@ -692,14 +689,12 @@ ZfsDaemon::EventLoop()
}
if ((fds[0].revents & POLLERR) != 0) {
- /* Try reconnecting. */
- syslog(LOG_INFO, "Error on socket. Disconnecting.");
+ syslog(LOG_INFO, "POLLERROR detected on devd socket.");
break;
}
if ((fds[0].revents & POLLHUP) != 0) {
- /* Try reconnecting. */
- syslog(LOG_INFO, "Hup on socket. Disconnecting.");
+ syslog(LOG_INFO, "POLLHUP detected on devd socket.");
break;
}
}
More information about the svn-src-projects
mailing list