From owner-svn-src-projects@FreeBSD.ORG Mon Oct 14 23:13:04 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 44B23A5B; Mon, 14 Oct 2013 23:13:04 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 327C72EDB; Mon, 14 Oct 2013 23:13:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9END4Su024415; Mon, 14 Oct 2013 23:13:04 GMT (envelope-from asomers@svn.freebsd.org) Received: (from asomers@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9END4Eg024414; Mon, 14 Oct 2013 23:13:04 GMT (envelope-from asomers@svn.freebsd.org) Message-Id: <201310142313.r9END4Eg024414@svn.freebsd.org> From: Alan Somers Date: Mon, 14 Oct 2013 23:13:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r256472 - projects/zfsd/head/lib/libdevctl X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2013 23:13:04 -0000 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)