NetBSD Problem Report #56460

From martin@aprisoft.de  Wed Oct 20 11:33:49 2021
Return-Path: <martin@aprisoft.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 4A64E1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 20 Oct 2021 11:33:49 +0000 (UTC)
Message-Id: <20211020113339.A8C755CC84B@emmas.aprisoft.de>
Date: Wed, 20 Oct 2021 13:33:39 +0200 (CEST)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: knote deadlock in -current
X-Send-Pr-Version: 3.95

>Number:         56460
>Category:       kern
>Synopsis:       genfs_rename_knote() KASSERT fires
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    thorpej
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 20 11:35:01 +0000 2021
>Closed-Date:    Thu Oct 21 07:28:29 +0000 2021
>Last-Modified:  Thu Oct 21 07:28:29 +0000 2021
>Originator:     Martin Husemann
>Release:        NetBSD 9.99.92
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD seven-days-to-the-wolves.aprisoft.de 9.99.92 NetBSD 9.99.92 (GENERIC) #489: Wed Oct 20 11:02:22 CEST 2021 martin@seven-days-to-the-wolves.aprisoft.de:/work/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

Building -current with high enough MAKE_JOBS and bad luck deadlocks:

db{0}> ps
PID    LID S CPU     FLAGS       STRUCT LWP *               NAME WAIT
20196>20196 7   1         0   ffff86084d4b60c0           conftest
[..]

with no progress ever, console blocked, network dead.

db{0}> bt /a ffff86084d4b60c0
trace: pid 20196 lid 20196 at 0xffffab026d768b10
db_panic() at netbsd:db_panic+0x59
vpanic() at netbsd:vpanic+0x156
__x86_indirect_thunk_rax() at netbsd:__x86_indirect_thunk_rax
genfs_rename_knote() at netbsd:genfs_rename_knote+0x33d
genfs_sane_rename() at netbsd:genfs_sane_rename+0x560
ufs_sane_rename() at netbsd:ufs_sane_rename+0x3a
genfs_insane_rename() at netbsd:genfs_insane_rename+0x142
VOP_RENAME() at netbsd:VOP_RENAME+0x6e
do_sys_renameat() at netbsd:do_sys_renameat+0x932
sys_rename() at netbsd:sys_rename+0x28
syscall() at netbsd:syscall+0x196
--- syscall (number 128) ---
netbsd:syscall+0x196:

(gdb) list *(genfs_rename_knote+0x33d)
0xffffffff80dca17a is in genfs_rename_knote (../../../../miscfs/genfs/genfs_rename.c:402).
397             KASSERT(fdvp != fvp);
398             KASSERT(fdvp != tvp);
399             KASSERT(tdvp != fvp);
400             KASSERT(tdvp != tvp);
401             KASSERT(fvp != tvp);
402             KASSERT(VOP_ISLOCKED(fdvp) == LK_EXCLUSIVE);
403             KASSERT(VOP_ISLOCKED(fvp) == LK_EXCLUSIVE);
404             KASSERT(VOP_ISLOCKED(tdvp) == LK_EXCLUSIVE);
405             KASSERT((tvp == NULL) || (VOP_ISLOCKED(tvp) == LK_EXCLUSIVE));
406     


>How-To-Repeat:
n/a

>Fix:
n/a

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->thorpej
Responsible-Changed-By: thorpej@NetBSD.org
Responsible-Changed-When: Wed, 20 Oct 2021 12:24:57 +0000
Responsible-Changed-Why:
Take.


State-Changed-From-To: open->feedback
State-Changed-By: thorpej@NetBSD.org
State-Changed-When: Wed, 20 Oct 2021 13:30:05 +0000
State-Changed-Why:
Should be fixed by:
/cvsroot/src/sys/miscfs/genfs/genfs_rename.c,v  <--  genfs_rename.c
new revision: 1.7; previous revision: 1.6

Please confirm.
(I'm adding an ATF test for this specific case, as well.)


From: "Jason R Thorpe" <thorpej@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56460 CVS commit: src/sys/miscfs/genfs
Date: Wed, 20 Oct 2021 13:29:06 +0000

 Module Name:	src
 Committed By:	thorpej
 Date:		Wed Oct 20 13:29:06 UTC 2021

 Modified Files:
 	src/sys/miscfs/genfs: genfs_rename.c

 Log Message:
 Don't use genfs_rename_knote() in the "rename foo over hard-link to itself"
 case, which simply results in removing the "from" name; there are assertions
 in genfs_rename_knote() that are too strong for that case.

 PR kern/56460


 To generate a diff of this commit:
 cvs rdiff -u -r1.6 -r1.7 src/sys/miscfs/genfs/genfs_rename.c

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

From: "Jason R Thorpe" <thorpej@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56460 CVS commit: src/tests/kernel/kqueue
Date: Wed, 20 Oct 2021 14:33:15 +0000

 Module Name:	src
 Committed By:	thorpej
 Date:		Wed Oct 20 14:33:14 UTC 2021

 Modified Files:
 	src/tests/kernel/kqueue: t_vnode.c

 Log Message:
 Add a test case for PR kern/56460.


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/tests/kernel/kqueue/t_vnode.c

 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: martin@NetBSD.org
State-Changed-When: Thu, 21 Oct 2021 07:28:29 +0000
State-Changed-Why:
Can not reproduce it any more - thanks for the quick fix!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.