NetBSD Problem Report #47146

From dholland@netbsd.org  Wed Oct 31 09:45:10 2012
Return-Path: <dholland@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id F3E0D63CAFB
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 31 Oct 2012 09:45:09 +0000 (UTC)
Message-Id: <20121031094509.D2E8114A14B@mail.netbsd.org>
Date: Wed, 31 Oct 2012 09:45:09 +0000 (UTC)
From: dholland@netbsd.org
Reply-To: dholland@netbsd.org
To: gnats-bugs@gnats.NetBSD.org
Subject: user-triggerable crash in wapbl_register_deallocation (confi)
X-Send-Pr-Version: 3.95

>Number:         47146
>Category:       kern
>Synopsis:       user-triggerable crash in wapbl_register_deallocation (confi)
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    jdolecek
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 31 09:50:00 +0000 2012
>Closed-Date:    Thu Nov 10 21:19:40 +0000 2016
>Last-Modified:  Sun Nov 22 09:15:01 +0000 2026
>Originator:     David A. Holland
>Release:        6.99.14 (and netbsd-6 and netbsd-5)
>Organization:
>Environment:
n/a
>Description:

As noted in <5243E632-0190-4CA8-965B-5E7D9809917D@Akua.com> in
current-users on 24 Oct 2012, this panic:

	/* XXX should eventually instead tie this into resource estimation */
	/*
	 * XXX this panic needs locking/mutex analysis and the
	 * ability to cope with the failure.
	 */
	/* XXX this XXX doesn't have enough XXX */
	if (__predict_false(wl->wl_dealloccnt >= wl->wl_dealloclim))
		panic("wapbl_register_deallocation: out of resources");

(in src/sys/kern/vfs_wapbl.c) can be triggered by trying to remove
large numbers of files at once. This is of course is something any
user can do, or can (by default) arrange to happen in their absence at
the next reboot,

Which really won't do.

>How-To-Repeat:

>Fix:

I don't know. Nobody's ever really explained satisfactorily even why
pieces of wapbl exist outside of src/sys/ufs.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->jdolecek
Responsible-Changed-By: jdolecek@NetBSD.org
Responsible-Changed-When: Fri, 16 Sep 2016 15:07:16 +0000
Responsible-Changed-Why:
I've encountered the same issue, and working on a fix. It's actually very
closely tied to kern/49175, part of patch provided there should fix this issue
as well. I plan to fix this differently, changing the cache flush
triggered by wapbl_start() to actually flush when there are dealloc buffers
over the limit.


State-Changed-From-To: open->feedback
State-Changed-By: jdolecek@NetBSD.org
State-Changed-When: Fri, 28 Oct 2016 20:39:06 +0000
State-Changed-Why:
Fix committed on -current, can you confirm it fixes the problem for you?


From: "Jaromir Dolecek" <jdolecek@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47146 CVS commit: src/sys
Date: Fri, 28 Oct 2016 20:38:12 +0000

 Module Name:	src
 Committed By:	jdolecek
 Date:		Fri Oct 28 20:38:12 UTC 2016

 Modified Files:
 	src/sys/kern: vfs_wapbl.c
 	src/sys/sys: wapbl.h
 	src/sys/ufs/ffs: ffs_alloc.c ffs_inode.c ffs_snapshot.c
 	src/sys/ufs/ufs: ufs_extern.h ufs_inode.c ufs_rename.c ufs_vnops.c
 	    ufs_wapbl.h

 Log Message:
 reorganize ffs_truncate()/ffs_indirtrunc() to be able to partially
 succeed; change wapbl_register_deallocation() to return EAGAIN
 rather than panic when code hits the limit

 callers changed to either loop calling ffs_truncate() using new
 utility ufs_truncate_retry() if their semantics requires it, or
 just ignore the failure; remove ufs_wapbl_truncate()

 this fixes possible user-triggerable panic during truncate, and
 resolves WAPBL performance issue with truncates of large files

 PR kern/47146 and kern/49175


 To generate a diff of this commit:
 cvs rdiff -u -r1.84 -r1.85 src/sys/kern/vfs_wapbl.c
 cvs rdiff -u -r1.18 -r1.19 src/sys/sys/wapbl.h
 cvs rdiff -u -r1.152 -r1.153 src/sys/ufs/ffs/ffs_alloc.c
 cvs rdiff -u -r1.117 -r1.118 src/sys/ufs/ffs/ffs_inode.c
 cvs rdiff -u -r1.142 -r1.143 src/sys/ufs/ffs/ffs_snapshot.c
 cvs rdiff -u -r1.82 -r1.83 src/sys/ufs/ufs/ufs_extern.h
 cvs rdiff -u -r1.96 -r1.97 src/sys/ufs/ufs/ufs_inode.c
 cvs rdiff -u -r1.12 -r1.13 src/sys/ufs/ufs/ufs_rename.c
 cvs rdiff -u -r1.232 -r1.233 src/sys/ufs/ufs/ufs_vnops.c
 cvs rdiff -u -r1.11 -r1.12 src/sys/ufs/ufs/ufs_wapbl.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: feedback->closed
State-Changed-By: jdolecek@NetBSD.org
State-Changed-When: Thu, 10 Nov 2016 21:19:40 +0000
State-Changed-Why:
Fixed in -current.


From: "Juergen Hannken-Illjes" <hannken@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47146 CVS commit: src/sys/kern
Date: Sun, 22 Nov 2026 09:14:51 +0000

 Module Name:	src
 Committed By:	hannken
 Date:		Sun Nov 22 09:14:51 UTC 2026

 Modified Files:
 	src/sys/kern: vfs_wapbl.c

 Log Message:
 The evaluation of resource shortage in wapbl_register_deallocation()
 is incomplete as only "wl_dealloccnt" is checked.  Replace this check with
 the doflush check from wapbl_begin() testing for 75% instead 50% to
 make sure the next wapbl_begin() will always flush.

 It is still a mitigation, for a fix the file system must provide an
 upper bound for every transaction to wapbl_begin().

 PR kern/47146 user-triggerable crash in wapbl_register_deallocation (confi)
 PR kern/60621 (panic: ufs_inactive: dirty filesystem?)


 To generate a diff of this commit:
 cvs rdiff -u -r1.117 -r1.118 src/sys/kern/vfs_wapbl.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:




 Reinoud@, 23-okt-2014  :

 I could replicate it over and over again. My server would fall over
 every 3 hours or so without me deleting files manually. On reboot the log
 was replayed and everything looked OK. On manual fsck'ing i however found
 that not all was well: there were missing blocks in the free list:
 FREE BLK COUNT(S) WRONG IN SUPERBLK

 After this fix it seems to be steady again.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.