From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 24 19:03:31 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A19662B; Tue, 24 Dec 2013 19:03:31 +0000 (UTC) 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 761BB186D; Tue, 24 Dec 2013 19:03:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBOJ3VEr028711; Tue, 24 Dec 2013 19:03:31 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBOJ3Vdk028710; Tue, 24 Dec 2013 19:03:31 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201312241903.rBOJ3Vdk028710@svn.freebsd.org> From: John Baldwin Date: Tue, 24 Dec 2013 19:03:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r259836 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2013 19:03:31 -0000 Author: jhb Date: Tue Dec 24 19:03:30 2013 New Revision: 259836 URL: http://svnweb.freebsd.org/changeset/base/259836 Log: MFC 258869: Fix an off-by-one error in r228960. The maximum priority delta provided by SCHED_PRI_TICKS should be SCHED_PRI_RANGE - 1 so that the resulting priority value (before nice adjustment) is between SCHED_PRI_MIN and SCHED_PRI_MAX, inclusive. Modified: stable/8/sys/kern/sched_ule.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/sched_ule.c ============================================================================== --- stable/8/sys/kern/sched_ule.c Tue Dec 24 19:02:04 2013 (r259835) +++ stable/8/sys/kern/sched_ule.c Tue Dec 24 19:03:30 2013 (r259836) @@ -1488,7 +1488,7 @@ sched_priority(struct thread *td) pri = SCHED_PRI_MIN; if (td->td_sched->ts_ticks) pri += min(SCHED_PRI_TICKS(td->td_sched), - SCHED_PRI_RANGE); + SCHED_PRI_RANGE - 1); pri += SCHED_PRI_NICE(td->td_proc->p_nice); KASSERT(pri >= PRI_MIN_BATCH && pri <= PRI_MAX_BATCH, ("sched_priority: invalid priority %d: nice %d, " From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 24 23:50:36 2013 Return-Path: Delivered-To: svn-src-stable-8@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 ESMTPS id 4C0B19A7; Tue, 24 Dec 2013 23:50:36 +0000 (UTC) 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 3796B1AB0; Tue, 24 Dec 2013 23:50:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBONoasY035045; Tue, 24 Dec 2013 23:50:36 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBONoaxl035044; Tue, 24 Dec 2013 23:50:36 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201312242350.rBONoaxl035044@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 24 Dec 2013 23:50:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r259849 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2013 23:50:36 -0000 Author: ae Date: Tue Dec 24 23:50:35 2013 New Revision: 259849 URL: http://svnweb.freebsd.org/changeset/base/259849 Log: MFC r259520: Fix copy/paste typo. Modified: stable/8/sys/kern/kern_jail.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/kern_jail.c ============================================================================== --- stable/8/sys/kern/kern_jail.c Tue Dec 24 23:26:59 2013 (r259848) +++ stable/8/sys/kern/kern_jail.c Tue Dec 24 23:50:35 2013 (r259849) @@ -2959,7 +2959,7 @@ prison_restrict_ip6(struct prison *pr, s ii++; continue; } - switch (ij >= ppr->pr_ip4s ? -1 : + switch (ij >= ppr->pr_ip6s ? -1 : qcmp_v6(&pr->pr_ip6[ii], &ppr->pr_ip6[ij])) { case -1: bcopy(pr->pr_ip6 + ii + 1, pr->pr_ip6 + ii, From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 25 00:48:09 2013 Return-Path: Delivered-To: svn-src-stable-8@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 ESMTPS id 89C40576; Wed, 25 Dec 2013 00:48:09 +0000 (UTC) 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 751621F12; Wed, 25 Dec 2013 00:48:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBP0m97R055355; Wed, 25 Dec 2013 00:48:09 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBP0m9dZ055354; Wed, 25 Dec 2013 00:48:09 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312250048.rBP0m9dZ055354@svn.freebsd.org> From: Dimitry Andric Date: Wed, 25 Dec 2013 00:48:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r259852 - in stable: 10/contrib/file 8/contrib/file 9/contrib/file X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2013 00:48:09 -0000 Author: dim Date: Wed Dec 25 00:48:08 2013 New Revision: 259852 URL: http://svnweb.freebsd.org/changeset/base/259852 Log: MFC r259724: Apply upstream commit 33312fd828e59c78ae4ee30fd70d0ca109748cf0 (by zoulasc) to contrib/file: don't write a char to a pointer. Modified: stable/8/contrib/file/compress.c Directory Properties: stable/8/contrib/file/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/file/compress.c stable/9/contrib/file/compress.c Directory Properties: stable/10/ (props changed) stable/9/contrib/file/ (props changed) Modified: stable/8/contrib/file/compress.c ============================================================================== --- stable/8/contrib/file/compress.c Wed Dec 25 00:40:42 2013 (r259851) +++ stable/8/contrib/file/compress.c Wed Dec 25 00:48:08 2013 (r259852) @@ -470,7 +470,7 @@ uncompressbuf(struct magic_set *ms, int #endif free(*newch); n = 0; - newch[0] = '\0'; + *newch = NULL; goto err; } else { n = r; From owner-svn-src-stable-8@FreeBSD.ORG Thu Dec 26 16:59:51 2013 Return-Path: Delivered-To: svn-src-stable-8@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 ESMTPS id 87C6E452; Thu, 26 Dec 2013 16:59:51 +0000 (UTC) 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 734EF10CE; Thu, 26 Dec 2013 16:59:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBQGxpPp077119; Thu, 26 Dec 2013 16:59:51 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBQGxp28077118; Thu, 26 Dec 2013 16:59:51 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201312261659.rBQGxp28077118@svn.freebsd.org> From: John Baldwin Date: Thu, 26 Dec 2013 16:59:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r259919 - stable/8/sys/security/audit X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2013 16:59:51 -0000 Author: jhb Date: Thu Dec 26 16:59:50 2013 New Revision: 259919 URL: http://svnweb.freebsd.org/changeset/base/259919 Log: MFC 259014: There is no sysctl with the MIB { CTL_KERN, KERN_MAXID }. Modified: stable/8/sys/security/audit/audit_bsm_klib.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/security/ (props changed) Modified: stable/8/sys/security/audit/audit_bsm_klib.c ============================================================================== --- stable/8/sys/security/audit/audit_bsm_klib.c Thu Dec 26 16:58:30 2013 (r259918) +++ stable/8/sys/security/audit/audit_bsm_klib.c Thu Dec 26 16:59:50 2013 (r259919) @@ -273,7 +273,6 @@ audit_ctlname_to_sysctlevent(int name[], case KERN_USRSTACK: case KERN_LOGSIGEXIT: case KERN_IOV_MAX: - case KERN_MAXID: return ((valid_arg & ARG_VALUE) ? AUE_SYSCTL : AUE_SYSCTL_NONADMIN); From owner-svn-src-stable-8@FreeBSD.ORG Fri Dec 27 23:09:41 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 163291DA; Fri, 27 Dec 2013 23:09:41 +0000 (UTC) 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 DB8C4188F; Fri, 27 Dec 2013 23:09:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBRN9eYh067965; Fri, 27 Dec 2013 23:09:40 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBRN9ew3067964; Fri, 27 Dec 2013 23:09:40 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201312272309.rBRN9ew3067964@svn.freebsd.org> From: Xin LI Date: Fri, 27 Dec 2013 23:09:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r259974 - in stable: 10/etc 8/etc 9/etc X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2013 23:09:41 -0000 Author: delphij Date: Fri Dec 27 23:09:40 2013 New Revision: 259974 URL: http://svnweb.freebsd.org/changeset/base/259974 Log: MFC r259973: Tighten default restrictions for ntpd(8) server and provide a link to NTP access restriction documentation. Modified: stable/8/etc/ntp.conf Directory Properties: stable/8/etc/ (props changed) Changes in other areas also in this revision: Modified: stable/10/etc/ntp.conf stable/9/etc/ntp.conf Directory Properties: stable/10/ (props changed) stable/9/etc/ (props changed) Modified: stable/8/etc/ntp.conf ============================================================================== --- stable/8/etc/ntp.conf Fri Dec 27 23:06:15 2013 (r259973) +++ stable/8/etc/ntp.conf Fri Dec 27 23:09:40 2013 (r259974) @@ -17,7 +17,7 @@ # users with a static IP and good upstream NTP servers to add a server # to the pool. See http://www.pool.ntp.org/join.html if you are interested. # -# The option `iburst' is used for faster initial synchronisation. +# The option `iburst' is used for faster initial synchronization. # server 0.freebsd.pool.ntp.org iburst server 1.freebsd.pool.ntp.org iburst @@ -35,21 +35,37 @@ server 2.freebsd.pool.ntp.org iburst # server 2.CC.pool.ntp.org iburst # -# Security: Only accept NTP traffic from the following hosts. -# The following configuration example only accepts traffic from the -# above defined servers. +# Security: +# +# By default, only allow time queries and block all other requests +# from unauthenticated clients. +# +# See http://support.ntp.org/bin/view/Support/AccessRestrictions +# for more information. +# +restrict default kod nomodify notrap nopeer noquery +restrict -6 default kod nomodify notrap nopeer noquery +# +# Alternatively, the following rules would block all unauthorized access. +# +#restrict default ignore +#restrict -6 default ignore +# +# In this case, all remote NTP time servers also need to be explicitly +# allowed or they would not be able to exchange time information with +# this server. # # Please note that this example doesn't work for the servers in # the pool.ntp.org domain since they return multiple A records. -# (This is the reason that by default they are commented out) # -#restrict default ignore #restrict 0.pool.ntp.org nomodify nopeer noquery notrap #restrict 1.pool.ntp.org nomodify nopeer noquery notrap #restrict 2.pool.ntp.org nomodify nopeer noquery notrap -#restrict 127.0.0.1 -#restrict -6 ::1 -#restrict 127.127.1.0 +# +# The following settings allow unrestricted access from the localhost +restrict 127.0.0.1 +restrict -6 ::1 +restrict 127.127.1.0 # # If a server loses sync with all upstream servers, NTP clients From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 28 00:03:16 2013 Return-Path: Delivered-To: svn-src-stable-8@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 ESMTPS id AFFA0177; Sat, 28 Dec 2013 00:03:16 +0000 (UTC) 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 9B40D1CE3; Sat, 28 Dec 2013 00:03:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBS03GV7090463; Sat, 28 Dec 2013 00:03:16 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBS03G6m090462; Sat, 28 Dec 2013 00:03:16 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312280003.rBS03G6m090462@svn.freebsd.org> From: Dimitry Andric Date: Sat, 28 Dec 2013 00:03:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r259976 - in stable: 10/contrib/gperf/lib 8/contrib/gperf/lib 9/contrib/gperf/lib X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2013 00:03:16 -0000 Author: dim Date: Sat Dec 28 00:03:15 2013 New Revision: 259976 URL: http://svnweb.freebsd.org/changeset/base/259976 Log: MFC r259756: Get rid of register keyword usage in gperf, it is totally obsolete for C++, and this allows gperf to be compiled for C++11 without a warning about it. Modified: stable/8/contrib/gperf/lib/getline.cc Directory Properties: stable/8/contrib/gperf/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/gperf/lib/getline.cc stable/9/contrib/gperf/lib/getline.cc Directory Properties: stable/10/ (props changed) stable/9/contrib/gperf/ (props changed) Modified: stable/8/contrib/gperf/lib/getline.cc ============================================================================== --- stable/8/contrib/gperf/lib/getline.cc Fri Dec 27 23:13:38 2013 (r259975) +++ stable/8/contrib/gperf/lib/getline.cc Sat Dec 28 00:03:15 2013 (r259976) @@ -57,7 +57,7 @@ getstr (char **lineptr, size_t *n, FILE for (;;) { - register int c = getc (stream); + int c = getc (stream); /* We always want at least one char left in the buffer, since we always (unless we get an error while reading the first char) From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 28 19:23:19 2013 Return-Path: Delivered-To: svn-src-stable-8@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 ESMTPS id 0839C4F8; Sat, 28 Dec 2013 19:23:19 +0000 (UTC) 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 E634E1388; Sat, 28 Dec 2013 19:23:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBSJNIGH018640; Sat, 28 Dec 2013 19:23:18 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBSJNHZQ018630; Sat, 28 Dec 2013 19:23:17 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201312281923.rBSJNHZQ018630@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 28 Dec 2013 19:23:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r260008 - in stable/8/sbin: hastctl hastd X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2013 19:23:19 -0000 Author: trociny Date: Sat Dec 28 19:23:16 2013 New Revision: 260008 URL: http://svnweb.freebsd.org/changeset/base/260008 Log: MFC r257155, r257582, r259191, r259192, r259193, r259194, r259195, r259196: r257155: Make hastctl list command output current queue sizes. Reviewed by: pjd r257582 (pjd): Correct alignment. r259191: For memsync replication, hio_countdown is used not only as an indication when a request can be moved to done queue, but also for detecting the current state of memsync request. This approach has problems, e.g. leaking a request if memsynk ack from the secondary failed, or racy usage of write_complete, which should be called only once per write request, but for memsync can be entered by local_send_thread and ggate_send_thread simultaneously. So the following approach is implemented instead: 1) Use hio_countdown only for counting components we waiting to complete, i.e. initially it is always 2 for any replication mode. 2) To distinguish between "memsync ack" and "memsync fin" responses from the secondary, add and use hio_memsyncacked field. 3) write_complete() in component threads is called only before releasing hio_countdown (i.e. before the hio may be returned to the done queue). 4) Add and use hio_writecount refcounter to detect when write_complete() can be called in memsync case. Reported by: Pete French petefrench ingresso.co.uk Tested by: Pete French petefrench ingresso.co.uk r259192: Add some macros to make the code more readable (no functional chages). r259193: Fix compiler warnings. r259194: In remote_send_thread, if sending a request fails don't take the request back from the receive queue -- it might already be processed by remote_recv_thread, which lead to crashes like below: (primary) Unable to receive reply header: Connection reset by peer. (primary) Unable to send request (Connection reset by peer): WRITE(954662912, 131072). (primary) Disconnected from kopusha:7772. (primary) Increasing localcnt to 1. (primary) Assertion failed: (old > 0), function refcnt_release, file refcnt.h, line 62. Taking the request back was not necessary (it would properly be processed by the remote_recv_thread) and only complicated things. r259195: Send wakeup to threads waiting on empty queue before releasing the lock to decrease spurious wakeups. Submitted by: davidxu r259196: Check remote protocol version only for the first connection (when it is actually sent by the remote node). Otherwise it generated confusing "Negotiated protocol version 1" debug messages when processing the second connection. Modified: stable/8/sbin/hastctl/hastctl.c stable/8/sbin/hastd/control.c stable/8/sbin/hastd/hast.h stable/8/sbin/hastd/hastd.8 stable/8/sbin/hastd/hastd.c stable/8/sbin/hastd/nv.c stable/8/sbin/hastd/primary.c stable/8/sbin/hastd/proto.c stable/8/sbin/hastd/secondary.c Directory Properties: stable/8/sbin/hastctl/ (props changed) stable/8/sbin/hastd/ (props changed) Modified: stable/8/sbin/hastctl/hastctl.c ============================================================================== --- stable/8/sbin/hastctl/hastctl.c Sat Dec 28 19:22:23 2013 (r260007) +++ stable/8/sbin/hastctl/hastctl.c Sat Dec 28 19:23:16 2013 (r260008) @@ -355,6 +355,13 @@ control_list(struct nv *nv) (uintmax_t)nv_get_uint64(nv, "stat_write_error%u", ii), (uintmax_t)nv_get_uint64(nv, "stat_delete_error%u", ii), (uintmax_t)nv_get_uint64(nv, "stat_flush_error%u", ii)); + printf(" queues: " + "local: %ju, send: %ju, recv: %ju, done: %ju, idle: %ju\n", + (uintmax_t)nv_get_uint64(nv, "local_queue_size%u", ii), + (uintmax_t)nv_get_uint64(nv, "send_queue_size%u", ii), + (uintmax_t)nv_get_uint64(nv, "recv_queue_size%u", ii), + (uintmax_t)nv_get_uint64(nv, "done_queue_size%u", ii), + (uintmax_t)nv_get_uint64(nv, "idle_queue_size%u", ii)); } return (ret); } Modified: stable/8/sbin/hastd/control.c ============================================================================== --- stable/8/sbin/hastd/control.c Sat Dec 28 19:22:23 2013 (r260007) +++ stable/8/sbin/hastd/control.c Sat Dec 28 19:23:16 2013 (r260008) @@ -215,6 +215,16 @@ control_status_worker(struct hast_resour "stat_delete_error%u", no); nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_flush_error"), "stat_flush_error%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "idle_queue_size"), + "idle_queue_size%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "local_queue_size"), + "local_queue_size%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "send_queue_size"), + "send_queue_size%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "recv_queue_size"), + "recv_queue_size%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "done_queue_size"), + "done_queue_size%u", no); end: if (cnvin != NULL) nv_free(cnvin); @@ -478,6 +488,7 @@ ctrl_thread(void *arg) nv_add_uint64(nvout, res->hr_stat_flush_error + res->hr_stat_activemap_flush_error, "stat_flush_error"); + res->output_status_aux(nvout); nv_add_int16(nvout, 0, "error"); break; case CONTROL_RELOAD: Modified: stable/8/sbin/hastd/hast.h ============================================================================== --- stable/8/sbin/hastd/hast.h Sat Dec 28 19:22:23 2013 (r260007) +++ stable/8/sbin/hastd/hast.h Sat Dec 28 19:23:16 2013 (r260008) @@ -137,6 +137,8 @@ struct hastd_config { #define HAST_CHECKSUM_CRC32 1 #define HAST_CHECKSUM_SHA256 2 +struct nv; + /* * Structure that describes single resource. */ @@ -254,6 +256,9 @@ struct hast_resource { /* Number of activemap flush errors. */ uint64_t hr_stat_activemap_flush_error; + /* Function to output worker specific info on control status request. */ + void (*output_status_aux)(struct nv *); + /* Next resource. */ TAILQ_ENTRY(hast_resource) hr_next; }; Modified: stable/8/sbin/hastd/hastd.8 ============================================================================== --- stable/8/sbin/hastd/hastd.8 Sat Dec 28 19:22:23 2013 (r260007) +++ stable/8/sbin/hastd/hastd.8 Sat Dec 28 19:23:16 2013 (r260008) @@ -171,7 +171,7 @@ The default location is .Pa /var/run/hastd.pid . .El .Sh FILES -.Bl -tag -width ".Pa /var/run/hastctl" -compact +.Bl -tag -width ".Pa /var/run/hastd.pid" -compact .It Pa /etc/hast.conf The configuration file for .Nm Modified: stable/8/sbin/hastd/hastd.c ============================================================================== --- stable/8/sbin/hastd/hastd.c Sat Dec 28 19:22:23 2013 (r260007) +++ stable/8/sbin/hastd/hastd.c Sat Dec 28 19:23:16 2013 (r260008) @@ -806,12 +806,6 @@ listen_accept(struct hastd_listen *lst) */ version = 1; } - if (version > HAST_PROTO_VERSION) { - pjdlog_info("Remote protocol version %hhu is not supported, falling back to version %hhu.", - version, (unsigned char)HAST_PROTO_VERSION); - version = HAST_PROTO_VERSION; - } - pjdlog_debug(1, "Negotiated protocol version %hhu.", version); token = nv_get_uint8_array(nvin, &size, "token"); /* * NULL token means that this is first connection. @@ -925,6 +919,12 @@ listen_accept(struct hastd_listen *lst) */ if (token == NULL) { + if (version > HAST_PROTO_VERSION) { + pjdlog_info("Remote protocol version %hhu is not supported, falling back to version %hhu.", + version, (unsigned char)HAST_PROTO_VERSION); + version = HAST_PROTO_VERSION; + } + pjdlog_debug(1, "Negotiated protocol version %hhu.", version); res->hr_version = version; arc4random_buf(res->hr_token, sizeof(res->hr_token)); nvout = nv_alloc(); Modified: stable/8/sbin/hastd/nv.c ============================================================================== --- stable/8/sbin/hastd/nv.c Sat Dec 28 19:22:23 2013 (r260007) +++ stable/8/sbin/hastd/nv.c Sat Dec 28 19:23:16 2013 (r260008) @@ -566,7 +566,7 @@ nv_get_string(struct nv *nv, const char return (NULL); PJDLOG_ASSERT((nvh->nvh_type & NV_ORDER_MASK) == NV_ORDER_HOST); PJDLOG_ASSERT(nvh->nvh_dsize >= 1); - str = NVH_DATA(nvh); + str = (char *)NVH_DATA(nvh); PJDLOG_ASSERT(str[nvh->nvh_dsize - 1] == '\0'); PJDLOG_ASSERT(strlen(str) == nvh->nvh_dsize - 1); return (str); Modified: stable/8/sbin/hastd/primary.c ============================================================================== --- stable/8/sbin/hastd/primary.c Sat Dec 28 19:22:23 2013 (r260007) +++ stable/8/sbin/hastd/primary.c Sat Dec 28 19:23:16 2013 (r260008) @@ -94,6 +94,15 @@ struct hio { */ bool hio_done; /* + * Number of components we are still waiting before sending write + * completion ack to GEOM Gate. Used for memsync. + */ + unsigned int hio_writecount; + /* + * Memsync request was acknowleged by remote. + */ + bool hio_memsyncacked; + /* * Remember replication from the time the request was initiated, * so we won't get confused when replication changes on reload. */ @@ -108,6 +117,7 @@ struct hio { * until some in-progress requests are freed. */ static TAILQ_HEAD(, hio) hio_free_list; +static size_t hio_free_list_size; static pthread_mutex_t hio_free_list_lock; static pthread_cond_t hio_free_list_cond; /* @@ -116,20 +126,26 @@ static pthread_cond_t hio_free_list_cond * responsible for managing his own send list. */ static TAILQ_HEAD(, hio) *hio_send_list; +static size_t *hio_send_list_size; static pthread_mutex_t *hio_send_list_lock; static pthread_cond_t *hio_send_list_cond; +#define hio_send_local_list_size hio_send_list_size[0] +#define hio_send_remote_list_size hio_send_list_size[1] /* * There is one recv list for every component, although local components don't * use recv lists as local requests are done synchronously. */ static TAILQ_HEAD(, hio) *hio_recv_list; +static size_t *hio_recv_list_size; static pthread_mutex_t *hio_recv_list_lock; static pthread_cond_t *hio_recv_list_cond; +#define hio_recv_remote_list_size hio_recv_list_size[1] /* * Request is placed on done list by the slowest component (the one that * decreased hio_countdown from 1 to 0). */ static TAILQ_HEAD(, hio) hio_done_list; +static size_t hio_done_list_size; static pthread_mutex_t hio_done_list_lock; static pthread_cond_t hio_done_list_cond; /* @@ -164,25 +180,21 @@ static pthread_mutex_t metadata_lock; ((res)->hr_remotein != NULL && (res)->hr_remoteout != NULL) #define QUEUE_INSERT1(hio, name, ncomp) do { \ - bool _wakeup; \ - \ mtx_lock(&hio_##name##_list_lock[(ncomp)]); \ - _wakeup = TAILQ_EMPTY(&hio_##name##_list[(ncomp)]); \ + if (TAILQ_EMPTY(&hio_##name##_list[(ncomp)])) \ + cv_broadcast(&hio_##name##_list_cond[(ncomp)]); \ TAILQ_INSERT_TAIL(&hio_##name##_list[(ncomp)], (hio), \ hio_next[(ncomp)]); \ - mtx_unlock(&hio_##name##_list_lock[ncomp]); \ - if (_wakeup) \ - cv_broadcast(&hio_##name##_list_cond[(ncomp)]); \ + hio_##name##_list_size[(ncomp)]++; \ + mtx_unlock(&hio_##name##_list_lock[(ncomp)]); \ } while (0) #define QUEUE_INSERT2(hio, name) do { \ - bool _wakeup; \ - \ mtx_lock(&hio_##name##_list_lock); \ - _wakeup = TAILQ_EMPTY(&hio_##name##_list); \ + if (TAILQ_EMPTY(&hio_##name##_list)) \ + cv_broadcast(&hio_##name##_list_cond); \ TAILQ_INSERT_TAIL(&hio_##name##_list, (hio), hio_##name##_next);\ + hio_##name##_list_size++; \ mtx_unlock(&hio_##name##_list_lock); \ - if (_wakeup) \ - cv_broadcast(&hio_##name##_list_cond); \ } while (0) #define QUEUE_TAKE1(hio, name, ncomp, timeout) do { \ bool _last; \ @@ -196,6 +208,8 @@ static pthread_mutex_t metadata_lock; _last = true; \ } \ if (hio != NULL) { \ + PJDLOG_ASSERT(hio_##name##_list_size[(ncomp)] != 0); \ + hio_##name##_list_size[(ncomp)]--; \ TAILQ_REMOVE(&hio_##name##_list[(ncomp)], (hio), \ hio_next[(ncomp)]); \ } \ @@ -207,10 +221,16 @@ static pthread_mutex_t metadata_lock; cv_wait(&hio_##name##_list_cond, \ &hio_##name##_list_lock); \ } \ + PJDLOG_ASSERT(hio_##name##_list_size != 0); \ + hio_##name##_list_size--; \ TAILQ_REMOVE(&hio_##name##_list, (hio), hio_##name##_next); \ mtx_unlock(&hio_##name##_list_lock); \ } while (0) +#define ISFULLSYNC(hio) ((hio)->hio_replication == HAST_REPLICATION_FULLSYNC) +#define ISMEMSYNC(hio) ((hio)->hio_replication == HAST_REPLICATION_MEMSYNC) +#define ISASYNC(hio) ((hio)->hio_replication == HAST_REPLICATION_ASYNC) + #define SYNCREQ(hio) do { \ (hio)->hio_ggio.gctl_unit = -1; \ (hio)->hio_ggio.gctl_seq = 1; \ @@ -219,6 +239,9 @@ static pthread_mutex_t metadata_lock; #define SYNCREQDONE(hio) do { (hio)->hio_ggio.gctl_unit = -2; } while (0) #define ISSYNCREQDONE(hio) ((hio)->hio_ggio.gctl_unit == -2) +#define ISMEMSYNCWRITE(hio) (ISMEMSYNC(hio) && \ + (hio)->hio_ggio.gctl_cmd == BIO_WRITE && !ISSYNCREQ(hio)) + static struct hast_resource *gres; static pthread_mutex_t range_lock; @@ -239,6 +262,22 @@ static void *sync_thread(void *arg); static void *guard_thread(void *arg); static void +output_status_aux(struct nv *nvout) +{ + + nv_add_uint64(nvout, (uint64_t)hio_free_list_size, + "idle_queue_size"); + nv_add_uint64(nvout, (uint64_t)hio_send_local_list_size, + "local_queue_size"); + nv_add_uint64(nvout, (uint64_t)hio_send_remote_list_size, + "send_queue_size"); + nv_add_uint64(nvout, (uint64_t)hio_recv_remote_list_size, + "recv_queue_size"); + nv_add_uint64(nvout, (uint64_t)hio_done_list_size, + "done_queue_size"); +} + +static void cleanup(struct hast_resource *res) { int rerrno; @@ -355,6 +394,12 @@ init_environment(struct hast_resource *r "Unable to allocate %zu bytes of memory for send lists.", sizeof(hio_send_list[0]) * ncomps); } + hio_send_list_size = malloc(sizeof(hio_send_list_size[0]) * ncomps); + if (hio_send_list_size == NULL) { + primary_exitx(EX_TEMPFAIL, + "Unable to allocate %zu bytes of memory for send list counters.", + sizeof(hio_send_list_size[0]) * ncomps); + } hio_send_list_lock = malloc(sizeof(hio_send_list_lock[0]) * ncomps); if (hio_send_list_lock == NULL) { primary_exitx(EX_TEMPFAIL, @@ -373,6 +418,12 @@ init_environment(struct hast_resource *r "Unable to allocate %zu bytes of memory for recv lists.", sizeof(hio_recv_list[0]) * ncomps); } + hio_recv_list_size = malloc(sizeof(hio_recv_list_size[0]) * ncomps); + if (hio_recv_list_size == NULL) { + primary_exitx(EX_TEMPFAIL, + "Unable to allocate %zu bytes of memory for recv list counters.", + sizeof(hio_recv_list_size[0]) * ncomps); + } hio_recv_list_lock = malloc(sizeof(hio_recv_list_lock[0]) * ncomps); if (hio_recv_list_lock == NULL) { primary_exitx(EX_TEMPFAIL, @@ -393,16 +444,18 @@ init_environment(struct hast_resource *r } /* - * Initialize lists, their locks and theirs condition variables. + * Initialize lists, their counters, locks and condition variables. */ TAILQ_INIT(&hio_free_list); mtx_init(&hio_free_list_lock); cv_init(&hio_free_list_cond); for (ii = 0; ii < HAST_NCOMPONENTS; ii++) { TAILQ_INIT(&hio_send_list[ii]); + hio_send_list_size[ii] = 0; mtx_init(&hio_send_list_lock[ii]); cv_init(&hio_send_list_cond[ii]); TAILQ_INIT(&hio_recv_list[ii]); + hio_recv_list_size[ii] = 0; mtx_init(&hio_recv_list_lock[ii]); cv_init(&hio_recv_list_cond[ii]); rw_init(&hio_remote_lock[ii]); @@ -445,6 +498,7 @@ init_environment(struct hast_resource *r hio->hio_ggio.gctl_length = MAXPHYS; hio->hio_ggio.gctl_error = 0; TAILQ_INSERT_HEAD(&hio_free_list, hio, hio_free_next); + hio_free_list_size++; } } @@ -963,6 +1017,7 @@ hastd_primary(struct hast_resource *res) } gres = res; + res->output_status_aux = output_status_aux; mode = pjdlog_mode_get(); debuglevel = pjdlog_debug_get(); @@ -1299,6 +1354,10 @@ ggate_recv_thread(void *arg) } else { mtx_unlock(&res->hr_amp_lock); } + if (ISMEMSYNC(hio)) { + hio->hio_memsyncacked = false; + hio->hio_writecount = ncomps; + } break; case BIO_DELETE: res->hr_stat_delete++; @@ -1310,11 +1369,6 @@ ggate_recv_thread(void *arg) pjdlog_debug(2, "ggate_recv: (%p) Moving request to the send queues.", hio); hio->hio_countdown = ncomps; - if (hio->hio_replication == HAST_REPLICATION_MEMSYNC && - ggio->gctl_cmd == BIO_WRITE) { - /* Each remote request needs two responses in memsync. */ - hio->hio_countdown++; - } for (ii = ncomp; ii < ncomps; ii++) QUEUE_INSERT1(hio, send, ii); } @@ -1385,8 +1439,7 @@ local_send_thread(void *arg) ret, (intmax_t)ggio->gctl_length); } else { hio->hio_errors[ncomp] = 0; - if (hio->hio_replication == - HAST_REPLICATION_ASYNC) { + if (ISASYNC(hio)) { ggio->gctl_error = 0; write_complete(res, hio); } @@ -1424,42 +1477,13 @@ local_send_thread(void *arg) } break; } - - if (hio->hio_replication != HAST_REPLICATION_MEMSYNC || - ggio->gctl_cmd != BIO_WRITE || ISSYNCREQ(hio)) { - if (refcnt_release(&hio->hio_countdown) > 0) - continue; - } else { - /* - * Depending on hio_countdown value, requests finished - * in the following order: - * 0: remote memsync, remote final, local write - * 1: remote memsync, local write, (remote final) - * 2: local write, (remote memsync), (remote final) - */ - switch (refcnt_release(&hio->hio_countdown)) { - case 0: - /* - * Local write finished as last. - */ - break; - case 1: - /* - * Local write finished after remote memsync - * reply arrvied. We can complete the write now. - */ - if (hio->hio_errors[0] == 0) - write_complete(res, hio); - continue; - case 2: - /* - * Local write finished as first. - */ - continue; - default: - PJDLOG_ABORT("Invalid hio_countdown."); + if (ISMEMSYNCWRITE(hio)) { + if (refcnt_release(&hio->hio_writecount) == 0) { + write_complete(res, hio); } } + if (refcnt_release(&hio->hio_countdown) > 0) + continue; if (ISSYNCREQ(hio)) { mtx_lock(&sync_lock); SYNCREQDONE(hio); @@ -1581,10 +1605,8 @@ remote_send_thread(void *arg) nv_add_uint64(nv, (uint64_t)ggio->gctl_seq, "seq"); nv_add_uint64(nv, offset, "offset"); nv_add_uint64(nv, length, "length"); - if (hio->hio_replication == HAST_REPLICATION_MEMSYNC && - ggio->gctl_cmd == BIO_WRITE && !ISSYNCREQ(hio)) { + if (ISMEMSYNCWRITE(hio)) nv_add_uint8(nv, 1, "memsync"); - } if (nv_error(nv) != 0) { hio->hio_errors[ncomp] = nv_error(nv); pjdlog_debug(2, @@ -1616,6 +1638,7 @@ remote_send_thread(void *arg) mtx_lock(&hio_recv_list_lock[ncomp]); wakeup = TAILQ_EMPTY(&hio_recv_list[ncomp]); TAILQ_INSERT_TAIL(&hio_recv_list[ncomp], hio, hio_next[ncomp]); + hio_recv_list_size[ncomp]++; mtx_unlock(&hio_recv_list_lock[ncomp]); if (hast_proto_send(res, res->hr_remoteout, nv, data, data != NULL ? length : 0) == -1) { @@ -1627,17 +1650,9 @@ remote_send_thread(void *arg) "Unable to send request (%s): ", strerror(hio->hio_errors[ncomp])); remote_close(res, ncomp); - /* - * Take request back from the receive queue and move - * it immediately to the done queue. - */ - mtx_lock(&hio_recv_list_lock[ncomp]); - TAILQ_REMOVE(&hio_recv_list[ncomp], hio, - hio_next[ncomp]); - mtx_unlock(&hio_recv_list_lock[ncomp]); - goto done_queue; + } else { + rw_unlock(&hio_remote_lock[ncomp]); } - rw_unlock(&hio_remote_lock[ncomp]); nv_free(nv); if (wakeup) cv_signal(&hio_recv_list_cond[ncomp]); @@ -1661,8 +1676,12 @@ done_queue: } else { mtx_unlock(&res->hr_amp_lock); } - if (hio->hio_replication == HAST_REPLICATION_MEMSYNC) - (void)refcnt_release(&hio->hio_countdown); + if (ISMEMSYNCWRITE(hio)) { + if (refcnt_release(&hio->hio_writecount) == 0) { + if (hio->hio_errors[0] == 0) + write_complete(res, hio); + } + } } if (refcnt_release(&hio->hio_countdown) > 0) continue; @@ -1718,7 +1737,9 @@ remote_recv_thread(void *arg) PJDLOG_ASSERT(hio != NULL); TAILQ_REMOVE(&hio_recv_list[ncomp], hio, hio_next[ncomp]); + hio_recv_list_size[ncomp]--; mtx_unlock(&hio_recv_list_lock[ncomp]); + hio->hio_errors[ncomp] = ENOTCONN; goto done_queue; } if (hast_proto_recv_hdr(res->hr_remotein, &nv) == -1) { @@ -1741,6 +1762,7 @@ remote_recv_thread(void *arg) if (hio->hio_ggio.gctl_seq == seq) { TAILQ_REMOVE(&hio_recv_list[ncomp], hio, hio_next[ncomp]); + hio_recv_list_size[ncomp]--; break; } } @@ -1791,80 +1813,34 @@ remote_recv_thread(void *arg) hio->hio_errors[ncomp] = 0; nv_free(nv); done_queue: - if (hio->hio_replication != HAST_REPLICATION_MEMSYNC || - hio->hio_ggio.gctl_cmd != BIO_WRITE || ISSYNCREQ(hio)) { - if (refcnt_release(&hio->hio_countdown) > 0) - continue; - } else { - /* - * Depending on hio_countdown value, requests finished - * in the following order: - * - * 0: local write, remote memsync, remote final - * or - * 0: remote memsync, local write, remote final - * - * 1: local write, remote memsync, (remote final) - * or - * 1: remote memsync, remote final, (local write) - * - * 2: remote memsync, (local write), (remote final) - * or - * 2: remote memsync, (remote final), (local write) - */ - switch (refcnt_release(&hio->hio_countdown)) { - case 0: - /* - * Remote final reply arrived. - */ - PJDLOG_ASSERT(!memsyncack); - break; - case 1: - if (memsyncack) { - /* - * Local request already finished, so we - * can complete the write. - */ + if (ISMEMSYNCWRITE(hio)) { + if (!hio->hio_memsyncacked) { + PJDLOG_ASSERT(memsyncack || + hio->hio_errors[ncomp] != 0); + /* Remote ack arrived. */ + if (refcnt_release(&hio->hio_writecount) == 0) { if (hio->hio_errors[0] == 0) write_complete(res, hio); - /* - * We still need to wait for final - * remote reply. - */ + } + hio->hio_memsyncacked = true; + if (hio->hio_errors[ncomp] == 0) { pjdlog_debug(2, - "remote_recv: (%p) Moving request back to the recv queue.", - hio); + "remote_recv: (%p) Moving request " + "back to the recv queue.", hio); mtx_lock(&hio_recv_list_lock[ncomp]); TAILQ_INSERT_TAIL(&hio_recv_list[ncomp], hio, hio_next[ncomp]); + hio_recv_list_size[ncomp]++; mtx_unlock(&hio_recv_list_lock[ncomp]); - } else { - /* - * Remote final reply arrived before - * local write finished. - * Nothing to do in such case. - */ + continue; } - continue; - case 2: - /* - * We received remote memsync reply even before - * local write finished. - */ - PJDLOG_ASSERT(memsyncack); - - pjdlog_debug(2, - "remote_recv: (%p) Moving request back to the recv queue.", - hio); - mtx_lock(&hio_recv_list_lock[ncomp]); - TAILQ_INSERT_TAIL(&hio_recv_list[ncomp], hio, - hio_next[ncomp]); - mtx_unlock(&hio_recv_list_lock[ncomp]); - continue; - default: - PJDLOG_ABORT("Invalid hio_countdown."); + } else { + PJDLOG_ASSERT(!memsyncack); + /* Remote final reply arrived. */ } } + if (refcnt_release(&hio->hio_countdown) > 0) + continue; if (ISSYNCREQ(hio)) { mtx_lock(&sync_lock); SYNCREQDONE(hio); Modified: stable/8/sbin/hastd/proto.c ============================================================================== --- stable/8/sbin/hastd/proto.c Sat Dec 28 19:22:23 2013 (r260007) +++ stable/8/sbin/hastd/proto.c Sat Dec 28 19:23:16 2013 (r260008) @@ -298,8 +298,8 @@ proto_connection_send(const struct proto protoname = mconn->pc_proto->prt_name; PJDLOG_ASSERT(protoname != NULL); - ret = conn->pc_proto->prt_send(conn->pc_ctx, protoname, - strlen(protoname) + 1, fd); + ret = conn->pc_proto->prt_send(conn->pc_ctx, + (const unsigned char *)protoname, strlen(protoname) + 1, fd); proto_close(mconn); if (ret != 0) { errno = ret; @@ -325,7 +325,7 @@ proto_connection_recv(const struct proto bzero(protoname, sizeof(protoname)); - ret = conn->pc_proto->prt_recv(conn->pc_ctx, protoname, + ret = conn->pc_proto->prt_recv(conn->pc_ctx, (unsigned char *)protoname, sizeof(protoname) - 1, &fd); if (ret != 0) { errno = ret; Modified: stable/8/sbin/hastd/secondary.c ============================================================================== --- stable/8/sbin/hastd/secondary.c Sat Dec 28 19:22:23 2013 (r260007) +++ stable/8/sbin/hastd/secondary.c Sat Dec 28 19:23:16 2013 (r260008) @@ -82,18 +82,21 @@ static struct hast_resource *gres; * until some in-progress requests are freed. */ static TAILQ_HEAD(, hio) hio_free_list; +static size_t hio_free_list_size; static pthread_mutex_t hio_free_list_lock; static pthread_cond_t hio_free_list_cond; /* * Disk thread (the one that does I/O requests) takes requests from this list. */ static TAILQ_HEAD(, hio) hio_disk_list; +static size_t hio_disk_list_size; static pthread_mutex_t hio_disk_list_lock; static pthread_cond_t hio_disk_list_cond; /* * Thread that sends requests back to primary takes requests from this list. */ static TAILQ_HEAD(, hio) hio_send_list; +static size_t hio_send_list_size; static pthread_mutex_t hio_send_list_lock; static pthread_cond_t hio_send_list_cond; @@ -107,14 +110,12 @@ static void *disk_thread(void *arg); static void *send_thread(void *arg); #define QUEUE_INSERT(name, hio) do { \ - bool _wakeup; \ - \ mtx_lock(&hio_##name##_list_lock); \ - _wakeup = TAILQ_EMPTY(&hio_##name##_list); \ + if (TAILQ_EMPTY(&hio_##name##_list)) \ + cv_broadcast(&hio_##name##_list_cond); \ TAILQ_INSERT_TAIL(&hio_##name##_list, (hio), hio_next); \ + hio_##name##_list_size++; \ mtx_unlock(&hio_##name##_list_lock); \ - if (_wakeup) \ - cv_broadcast(&hio_##name##_list_cond); \ } while (0) #define QUEUE_TAKE(name, hio) do { \ mtx_lock(&hio_##name##_list_lock); \ @@ -122,11 +123,22 @@ static void *send_thread(void *arg); cv_wait(&hio_##name##_list_cond, \ &hio_##name##_list_lock); \ } \ + PJDLOG_ASSERT(hio_##name##_list_size != 0); \ + hio_##name##_list_size--; \ TAILQ_REMOVE(&hio_##name##_list, (hio), hio_next); \ mtx_unlock(&hio_##name##_list_lock); \ } while (0) static void +output_status_aux(struct nv *nvout) +{ + + nv_add_uint64(nvout, (uint64_t)hio_free_list_size, "idle_queue_size"); + nv_add_uint64(nvout, (uint64_t)hio_disk_list_size, "local_queue_size"); + nv_add_uint64(nvout, (uint64_t)hio_send_list_size, "send_queue_size"); +} + +static void hio_clear(struct hio *hio) { @@ -190,6 +202,7 @@ init_environment(void) } hio_clear(hio); TAILQ_INSERT_HEAD(&hio_free_list, hio, hio_next); + hio_free_list_size++; } } @@ -441,6 +454,7 @@ hastd_secondary(struct hast_resource *re } gres = res; + res->output_status_aux = output_status_aux; mode = pjdlog_mode_get(); debuglevel = pjdlog_debug_get();