Date: Mon, 14 Oct 2013 23:13:04 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r256472 - projects/zfsd/head/lib/libdevctl Message-ID: <201310142313.r9END4Eg024414@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Mon Oct 14 23:13:03 2013 New Revision: 256472 URL: http://svnweb.freebsd.org/changeset/base/256472 Log: Fix a few libdevctl bugs found by inspection lib/libdevctl/consumer.cc: In Consummer::ConnectToDevd(), invoke DisconnectFromDevd() if our connect fails so that the connection to DevD is recorded as closed. This avoids fooling future invocations of ConnectToDevd() into thinking the connection is already established. In Consumer::FlushEvents(), handle in_avail() returning -1, which indicates and error. In Consumer::EventsPending(), update exception string to reflect the conversion of this class from ZfsDaemon to Consumer when it was refactored out of zfsd. Submitted by: gibbs Approved by: ken (mentor) Obtained from: Spectra Logic Corporation Modified: projects/zfsd/head/lib/libdevctl/consumer.cc Modified: projects/zfsd/head/lib/libdevctl/consumer.cc ============================================================================== --- projects/zfsd/head/lib/libdevctl/consumer.cc Mon Oct 14 23:06:12 2013 (r256471) +++ projects/zfsd/head/lib/libdevctl/consumer.cc Mon Oct 14 23:13:03 2013 (r256472) @@ -117,6 +117,7 @@ Consumer::ConnectToDevd() sLen); if (result == -1) { syslog(LOG_INFO, "Unable to connect to devd"); + DisconnectFromDevd(); return (false); } @@ -212,7 +213,7 @@ Consumer::FlushEvents() { char discardBuf[256]; - while (m_reader->in_avail()) + while (m_reader->in_avail() > 0) m_reader->read(discardBuf, sizeof(discardBuf)); } @@ -233,7 +234,7 @@ Consumer::EventsPending() err(1, "Polling for devd events failed"); if ((fds->revents & POLLERR) != 0) - throw Exception("ZfsdDaemon:EventsPending(): " + throw Exception("Consumer::EventsPending(): " "POLLERR detected on devd socket."); if ((fds->revents & POLLHUP) != 0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310142313.r9END4Eg024414>