NetBSD Problem Report #56189

From www@netbsd.org  Wed May 19 10:18:10 2021
Return-Path: <www@netbsd.org>
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 A90201A9246
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 19 May 2021 10:18:10 +0000 (UTC)
Message-Id: <20210519101809.1B14E1A9247@mollari.NetBSD.org>
Date: Wed, 19 May 2021 10:18:09 +0000 (UTC)
From: nia@pkgsrc.org
Reply-To: nia@pkgsrc.org
To: gnats-bugs@NetBSD.org
Subject: System panicked: /: bad dir ino 5045785 at offset 0: Bad dir (too big)
X-Send-Pr-Version: www-1.0

>Number:         56189
>Category:       kern
>Synopsis:       System panicked: /: bad dir ino 5045785 at offset 0: Bad dir (too big)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 19 10:20:00 +0000 2021
>Last-Modified:  Fri Jun 04 21:15:01 +0000 2021
>Originator:     nia
>Release:        current
>Organization:
The NetBSD Foundation
>Environment:
NetBSD amnesia 9.99.82 NetBSD 9.99.82 (NIAAMD64) #2: Tue May 18 12:32:39 CEST 2021  nia@amnesia:/src/obj/sys/arch/amd64/compile/NIAAMD64 amd64
>Description:
System panicked: /: bad dir ino 5045785 at offset 0: Bad dir (too big), reclen=0x4918, namlen=61, dirsiz=72 <= reclen=18712 <= maxsize=512, flags=0x46005000, entryoffsetinblock=0, dirblksiz=512

Backtrace:

(gdb) target kvm /var/crash/netbsd.12.core
0xffffffff80230d05 in cpu_reboot (howto=howto@entry=260, 
    bootstr=bootstr@entry=0x0) at /src/src/sys/arch/amd64/amd64/machdep.c:713
713                     dumpsys();
(gdb) bt
#0  0xffffffff80230d05 in cpu_reboot (howto=howto@entry=260, 
    bootstr=bootstr@entry=0x0) at /src/src/sys/arch/amd64/amd64/machdep.c:713
#1  0xffffffff8297279c in kern_reboot (howto=howto@entry=260, 
    bootstr=bootstr@entry=0x0) at /src/src/sys/kern/kern_reboot.c:73
#2  0xffffffff82a6dd19 in vpanic (
    fmt=0xffffffff835c07d0 "%s: bad dir ino %ju at offset %d: %s\n", 
    ap=ap@entry=0xffffb180bd6709e8) at /src/src/sys/kern/subr_prf.c:290
#3  0xffffffff82a6df32 in panic (fmt=<optimized out>)
    at /src/src/sys/kern/subr_prf.c:209
#4  0xffffffff827bb404 in ufs_dirbad (how=<optimized out>, 
    offset=<optimized out>, ip=0xfffffd89281e2838)
    at /src/src/sys/ufs/ufs/ufs_lookup.c:750
#5  ufs_lookup (v=<optimized out>) at /src/src/sys/ufs/ufs/ufs_lookup.c:530
#6  0xffffffff82c0657a in VOP_LOOKUP (dvp=dvp@entry=0xfffffd8928d90100, 
    vpp=vpp@entry=0xffffb180bd670c28, cnp=cnp@entry=0xffffb180bd670e88)
    at /src/src/sys/kern/vnode_if.c:177
#7  0xffffffff82b9d5b8 in lookup_once (state=state@entry=0xffffb180bd670dd0, 
    searchdir=<optimized out>, 
    newsearchdir_ret=newsearchdir_ret@entry=0xffffb180bd670d20, 
    foundobj_ret=foundobj_ret@entry=0xffffb180bd670d28, 
    newsearchdir_locked_ret=newsearchdir_locked_ret@entry=0xffffb180bd670d1f)
    at /src/src/sys/kern/vfs_lookup.c:1179
#8  0xffffffff82ba055d in namei_oneroot (isnfsd=0, inhibitmagic=0, 
    neverfollow=0, state=0xffffb180bd670dd0)
    at /src/src/sys/kern/vfs_lookup.c:1587
#9  namei_tryemulroot (state=state@entry=0xffffb180bd670dd0, 
    neverfollow=neverfollow@entry=0, inhibitmagic=inhibitmagic@entry=0, 
--Type <RET> for more, q to quit, c to continue without paging--

fstab:

NAME=028ec817-9e7b-4862-8ffd-bf50f88b9594       /       ffs     rw,log,noatime,nodevmtime        1 1
NAME=c2f516b8-77d9-4d7c-88f0-6019113a30c4       none    swap    sw,dp    0 0
NAME=src        /src            ffs     rw,noatime,nosuid,nodev,log      1 2
tmpfs           /tmp            tmpfs   rw,noatime,nosuid,nodev,-m1777,-sram%25
kernfs          /kern           kernfs  rw
ptyfs           /dev/pts        ptyfs   rw,noatime
procfs          /proc           procfs  rw
tmpfs           /var/shm        tmpfs   rw,noatime,nosuid,nodev,-m1777,-sram%25
>How-To-Repeat:
Unknown. Happened on boot when mounting FFS filesystems, then went away
on reboot.
>Fix:

>Audit-Trail:
From: nia <nia@NetBSD.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/56189: System panicked: /: bad dir ino 5045785 at offset 0:
 Bad dir (too big)
Date: Wed, 19 May 2021 10:22:13 +0000

 ... Here's the rest of the trace:

     snfsd@entry=0) at /src/src/sys/kern/vfs_lookup.c:1924
 #10 0xffffffff82ba6220 in namei (ndp=ndp@entry=0xffffb180bd670e38)
     at /src/src/sys/kern/vfs_lookup.c:1960
 #11 0xffffffff82bc7c96 in fd_nameiat (l=0x79089bd21440, 
     ndp=0xffffb180bd670e38, fdat=-100) at /src/src/sys/kern/vfs_syscalls.c:181
 #12 do_sys_statat (l=l@entry=0xfffffd8924e30040, fdat=fdat@entry=-100, 
     userpath=0x79089bd21440 <error: Cannot access memory at address 0x79089bd21440>, nd_flag=nd_flag@entry=64, sb=sb@entry=0xffffb180bd670ee8)
     at /src/src/sys/kern/vfs_syscalls.c:3158
 #13 0xffffffff82bc7d3a in sys___stat50 (l=0xfffffd8924e30040, 
     uap=0xffffb180bd671000, retval=<optimized out>)
     at /src/src/sys/kern/vfs_syscalls.c:3183
 #14 0xffffffff80f5f413 in sy_call (rval=0xffffb180bd670fb0, 
     uap=0xffffb180bd671000, l=0xfffffd8924e30040, 
     sy=0xffffffff84d97c88 <sysent+10536>) at /src/src/sys/sys/syscallvar.h:65
 #15 sy_invoke (code=439, rval=0xffffb180bd670fb0, uap=0xffffb180bd671000, 
     l=0xfffffd8924e30040, sy=0xffffffff84d97c88 <sysent+10536>)
     at /src/src/sys/sys/syscallvar.h:94
 #16 syscall (frame=0xffffb180bd671000)
     at /src/src/sys/arch/x86/x86/syscall.c:138

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/56189: System panicked: /: bad dir ino 5045785 at offset 0:
 Bad dir (too big)
Date: Fri, 4 Jun 2021 19:16:46 +0000

 On Wed, May 19, 2021 at 10:20:00AM +0000, nia@pkgsrc.org wrote:
  > System panicked: /: bad dir ino 5045785 at offset 0: Bad dir (too
  > big), reclen=0x4918, namlen=61, dirsiz=72 <= reclen=18712 <=
  > maxsize=512, flags=0x46005000, entryoffsetinblock=0, dirblksiz=512

 That's a thoroughly corrupt directory block; most likely it isn't a
 directory block at all.

 My first recommendation would be: track down the directory whose inode
 is 5045785 and see if it's garbaged. Also it might be interesting to
 print the inode structure (from fsdb or maybe ddb). Then (whether or
 not it's overtly borked) it's probably a good idea to fsck.

 I see from the fstab that it's wapbl; what kind of storage is it? (In
 particular, is it a consumer-grade SSD that has been subjected to a
 power failure recently?)

 -- 
 David A. Holland
 dholland@netbsd.org

From: nia <nia@NetBSD.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/56189: System panicked: /: bad dir ino 5045785 at offset 0:
 Bad dir (too big)
Date: Fri, 4 Jun 2021 21:12:33 +0000

 On Fri, Jun 04, 2021 at 07:20:01PM +0000, David Holland wrote:
 >  On Wed, May 19, 2021 at 10:20:00AM +0000, nia@pkgsrc.org wrote:
 >   > System panicked: /: bad dir ino 5045785 at offset 0: Bad dir (too
 >   > big), reclen=0x4918, namlen=61, dirsiz=72 <= reclen=18712 <=
 >   > maxsize=512, flags=0x46005000, entryoffsetinblock=0, dirblksiz=512
 >  
 >  That's a thoroughly corrupt directory block; most likely it isn't a
 >  directory block at all.
 >  
 >  My first recommendation would be: track down the directory whose inode
 >  is 5045785 and see if it's garbaged. Also it might be interesting to
 >  print the inode structure (from fsdb or maybe ddb). Then (whether or
 >  not it's overtly borked) it's probably a good idea to fsck.

 Hmm, this didn't occur to me for some reason.

 The directory is /usr/share/man/man8/cobalt (???) and appears normal.

 After this panic occurred, I was advised to force a fsck - but it
 didn't find anything. As mentioned, the problem went away on reboot
 and hasn't appered again.

 >  I see from the fstab that it's wapbl; what kind of storage is it? (In
 >  particular, is it a consumer-grade SSD that has been subjected to a
 >  power failure recently?)

 Consumer grade SSD; SATA; 1TB.
 It gets subjected to power failure a lot, unfortunately.

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.