From owner-svn-src-head@freebsd.org Mon Oct 16 16:14:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71153E3E4A1; Mon, 16 Oct 2017 16:14:52 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 D2A8C1D6C; Mon, 16 Oct 2017 16:14:51 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9GGEoux094645; Mon, 16 Oct 2017 16:14:50 GMT (envelope-from mjoras@FreeBSD.org) Received: (from mjoras@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9GGEoUN094644; Mon, 16 Oct 2017 16:14:50 GMT (envelope-from mjoras@FreeBSD.org) Message-Id: <201710161614.v9GGEoUN094644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjoras set sender to mjoras@FreeBSD.org using -f From: Matt Joras Date: Mon, 16 Oct 2017 16:14:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324666 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjoras X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 324666 X-SVN-Commit-Repository: base 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.23 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: Mon, 16 Oct 2017 16:14:52 -0000 Author: mjoras Date: Mon Oct 16 16:14:50 2017 New Revision: 324666 URL: https://svnweb.freebsd.org/changeset/base/324666 Log: Properly reset the fields in clean_unrhdr. In r324542 I neglected to reset the first and last fields of struct unrhdr. This causes a tmpfs to fail the unr(9) consistency checks with DIAGNOSTIC on. Fix this by resetting the fields by calling init_unrhdr. While here, change a loop to use TAILQ_FOREACH_SAFE since it is more readable and equally fast. Reported by: David Wolfskill Approved by: rstone (mentor) Sponsored by: Dell EMC Isilon Modified: head/sys/kern/subr_unit.c Modified: head/sys/kern/subr_unit.c ============================================================================== --- head/sys/kern/subr_unit.c Mon Oct 16 15:16:24 2017 (r324665) +++ head/sys/kern/subr_unit.c Mon Oct 16 16:14:50 2017 (r324666) @@ -373,18 +373,17 @@ clear_unrhdr(struct unrhdr *uh) KASSERT(TAILQ_EMPTY(&uh->ppfree), ("unrhdr has postponed item for free")); - up = TAILQ_FIRST(&uh->head); - while (up != NULL) { - uq = TAILQ_NEXT(up, list); + TAILQ_FOREACH_SAFE(up, &uh->head, list, uq) { if (up->ptr != uh) { Free(up->ptr); } Free(up); - up = uq; } - TAILQ_INIT(&uh->head); uh->busy = 0; uh->alloc = 0; + init_unrhdr(uh, uh->low, uh->high, uh->mtx); + + check_unrhdr(uh, __LINE__); } static __inline int