From owner-svn-src-head@FreeBSD.ORG Thu Feb 3 11:33:32 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFC7F1065673; Thu, 3 Feb 2011 11:33:32 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F8E18FC1A; Thu, 3 Feb 2011 11:33:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13BXWDC043964; Thu, 3 Feb 2011 11:33:32 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13BXW4b043962; Thu, 3 Feb 2011 11:33:32 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201102031133.p13BXW4b043962@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 3 Feb 2011 11:33:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218217 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Feb 2011 11:33:32 -0000 Author: pjd Date: Thu Feb 3 11:33:32 2011 New Revision: 218217 URL: http://svn.freebsd.org/changeset/base/218217 Log: Add missing locking after moving keepalive_send() to remote send thread in r214692. MFC after: 1 week Modified: head/sbin/hastd/primary.c Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Thu Feb 3 11:09:27 2011 (r218216) +++ head/sbin/hastd/primary.c Thu Feb 3 11:33:32 2011 (r218217) @@ -1230,8 +1230,12 @@ keepalive_send(struct hast_resource *res { struct nv *nv; - if (!ISCONNECTED(res, ncomp)) + rw_rlock(&hio_remote_lock[ncomp]); + + if (!ISCONNECTED(res, ncomp)) { + rw_unlock(&hio_remote_lock[ncomp]); return; + } PJDLOG_ASSERT(res->hr_remotein != NULL); PJDLOG_ASSERT(res->hr_remoteout != NULL); @@ -1239,20 +1243,22 @@ keepalive_send(struct hast_resource *res nv = nv_alloc(); nv_add_uint8(nv, HIO_KEEPALIVE, "cmd"); if (nv_error(nv) != 0) { + rw_unlock(&hio_remote_lock[ncomp]); nv_free(nv); pjdlog_debug(1, "keepalive_send: Unable to prepare header to send."); return; } if (hast_proto_send(res, res->hr_remoteout, nv, NULL, 0) < 0) { + rw_unlock(&hio_remote_lock[ncomp]); pjdlog_common(LOG_DEBUG, 1, errno, "keepalive_send: Unable to send request"); nv_free(nv); - rw_unlock(&hio_remote_lock[ncomp]); remote_close(res, ncomp); - rw_rlock(&hio_remote_lock[ncomp]); return; } + + rw_unlock(&hio_remote_lock[ncomp]); nv_free(nv); pjdlog_debug(2, "keepalive_send: Request sent."); }