From owner-svn-src-head@FreeBSD.ORG Fri Feb 6 12:18:39 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 503EF21D; Fri, 6 Feb 2015 12:18:39 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C81E930; Fri, 6 Feb 2015 12:18:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t16CIdht081812; Fri, 6 Feb 2015 12:18:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t16CIdrW081811; Fri, 6 Feb 2015 12:18:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201502061218.t16CIdrW081811@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 6 Feb 2015 12:18:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278313 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 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: Fri, 06 Feb 2015 12:18:39 -0000 Author: kib Date: Fri Feb 6 12:18:38 2015 New Revision: 278313 URL: https://svnweb.freebsd.org/changeset/base/278313 Log: Fully initialize allocated memory for the new barrier. The b_destroying member was left uninitialized, which caused spurious EBUSY. PR: 197365 Noted by: Florent Guiliani Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/lib/libthr/thread/thr_barrier.c Modified: head/lib/libthr/thread/thr_barrier.c ============================================================================== --- head/lib/libthr/thread/thr_barrier.c Fri Feb 6 10:10:57 2015 (r278312) +++ head/lib/libthr/thread/thr_barrier.c Fri Feb 6 12:18:38 2015 (r278313) @@ -86,16 +86,13 @@ _pthread_barrier_init(pthread_barrier_t if (barrier == NULL || count <= 0) return (EINVAL); - bar = malloc(sizeof(struct pthread_barrier)); + bar = calloc(1, sizeof(struct pthread_barrier)); if (bar == NULL) return (ENOMEM); _thr_umutex_init(&bar->b_lock); _thr_ucond_init(&bar->b_cv); - bar->b_cycle = 0; - bar->b_waiters = 0; bar->b_count = count; - bar->b_refcount = 0; *barrier = bar; return (0);