NetBSD Problem Report #54219

From www@netbsd.org  Sun May 19 18:15:39 2019
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-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 373DF7AD92
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 19 May 2019 18:15:39 +0000 (UTC)
Message-Id: <20190519181538.29FB07AD95@mollari.NetBSD.org>
Date: Sun, 19 May 2019 18:15:38 +0000 (UTC)
From: mdfarnsworth@gmail.com
Reply-To: mdfarnsworth@gmail.com
To: gnats-bugs@NetBSD.org
Subject: zpool create pool dk5 causes kernel panic
X-Send-Pr-Version: www-1.0

>Number:         54219
>Category:       kern
>Synopsis:       zpool create pool dk5 causes kernel panic
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          feedback
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 19 18:20:00 +0000 2019
>Closed-Date:    
>Last-Modified:  Sun May 26 10:25:01 +0000 2019
>Originator:     matt farnsworth
>Release:        8,0
>Organization:
>Environment:
virtual box
>Description:
panic: vrelel: bad ref count
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip 0xfffffffff8021fe95 cs 0x8 rflags 0x246 cr2 0x7f7fffb90a88 ilevel 0 rsp 0xffff8000693a4d20
curlwp 0xfffffe811e9a05c0 pid 0.182 lowest kstack 0xffff8000693a22c0
stopped in pid 0.182 (system) at netbsd:breakpoint+0x5: leave
kdb
vpanic
vcache_reclaim()
vcache_dealloc()
vdev_disk_open() at zfs:vdev_disk_open
vdev_open() at zfs:vdev_open
vdev_open_child() at zfs:vdev_open_child
taskq_thread at solaris:taskq_thread
>How-To-Repeat:
# freebsd zfs book recommends building VDEVS from partitiions
# netbsd does not have /dev/gpt, therefore no /dev/gpt/zfs1
gpt add -s 2g -l gpt_zfs1 -t fbsd_zfs wd1
# responds type not recognized ? maybe need to register nbsd_zfs uuid?
gpt show wd1
# ok. shows freeBSD zfs part
dkctl wd1 listwedges
# ok. dk5
zpool create pool /dev/dk5
# note: do not have gpt/zfs1 as in freebsd
panic
# also
zpool create pool mirror /dev/dk5 /dev/dk6
panic

>Fix:
I have not looked at the source code for this.
I don't really understand wedges (I haven't used netbsd for 10 years).
It seems strange that open would call dealloc, maybe its a test to reassign the wedge (it wasn't mounted, but maybe it was released before this taskq_thread?)
Maybe zpool should reject wedges (dk*) as block devices?
Maybe zfs.kmod should not use vcache calls for dk devices?
#
I tried using an alternate spec.
> zpool create pool wd1a
This succeeded without error and 
> zpool list 
shows the pool now exists, but
> zpool destroy pool
removes the partition too (gpt show wd1)
and corrupts the gpt label
> gpt add ...
# invalid label
I guess dual booting with freebsd would be a bad idea, but it looks like its very difficult with gpt anyway.

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sun, 19 May 2019 18:40:59 +0000
State-Changed-Why:
Please try -current. The difference between ZFS in 8.0 and -current is several years + it is in better shape.


From: Matt Farnsworth <mdfarnsworth@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/54219 (zpool create pool dk5 causes kernel panic)
Date: Sun, 19 May 2019 23:36:27 +0300

 I am confused. On the netbsd.org website I see 8.0 released july 2018 
 and 8.1 is not released yet. When you say current does that mean 8.1rc1 
 or rebuild from cvs?

 On 5/19/19 9:41 PM, maya@NetBSD.org wrote:
 > Synopsis: zpool create pool dk5 causes kernel panic
 >
 > State-Changed-From-To: open->feedback
 > State-Changed-By: maya@NetBSD.org
 > State-Changed-When: Sun, 19 May 2019 18:40:59 +0000
 > State-Changed-Why:
 > Please try -current. The difference between ZFS in 8.0 and -current is several years + it is in better shape.
 >
 >
 >

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/54219 (zpool create pool dk5 causes kernel panic)
Date: Mon, 20 May 2019 09:45:12 +0200

 On Sun, May 19, 2019 at 08:40:01PM +0000, Matt Farnsworth wrote:
 >  I am confused. On the netbsd.org website I see 8.0 released july 2018 
 >  and 8.1 is not released yet. When you say current does that mean 8.1rc1 
 >  or rebuild from cvs?

 Try a snapshot from the daily builds:

 	http://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/

 Martin

From: Matt Farnsworth <mdfarnsworth@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/54219 (zpool create pool dk5 causes kernel panic)
Date: Wed, 22 May 2019 16:54:07 +0300

 Ok, kernel version 8.99

 gpt create wd0
 gpt add -s 2g -t fbsd-zfs -l zfs-bsd wd0
 dkctl wd0 listwedges
  > zpool create pool dk0
 internal error: Inappropriate ioctl for device
  >zpool create pool wd0a
 cannot create: 'pool' : one or more vdevs refer to the same device

 Ok, I guess its handled in 8.99 -- though the messages are a bit cryptic.

 Note:

 gpt destroy wd0              # wipes the partition table but dkctl does 
 not know about this
 dkctl wd0 delwedge dk0 # to clean up.

 Notes: OpenIndiana hipster allows zfs in mbr partition, and recommends 
 gpt with whole disk only

 zpool does succeed with wd0 (wd0a same error as a above it mbr or gpt 
 (whole disk));
 but disk label tools fdisk and gpt can not report what file system is 
 using the disk

 Conclusions:
 I don't understand what is the point of dk* devices.
 It seems that zfs can not be used: to install into, nor on the same disk 
 as an ffs root
 What is the point of /dev/zpool/ ?
 The problem seems to be resolved in zpool application for netBSD image 8.99

 On 5/20/19 10:50 AM, Martin Husemann wrote:
 > The following reply was made to PR kern/54219; it has been noted by GNATS.
 >
 > From: Martin Husemann <martin@duskware.de>
 > To: gnats-bugs@netbsd.org
 > Cc:
 > Subject: Re: kern/54219 (zpool create pool dk5 causes kernel panic)
 > Date: Mon, 20 May 2019 09:45:12 +0200
 >
 >   On Sun, May 19, 2019 at 08:40:01PM +0000, Matt Farnsworth wrote:
 >   >  I am confused. On the netbsd.org website I see 8.0 released july 2018
 >   >  and 8.1 is not released yet. When you say current does that mean 8.1rc1
 >   >  or rebuild from cvs?
 >   
 >   Try a snapshot from the daily builds:
 >   
 >   	http://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/
 >   
 >   Martin
 >   

From: "Juergen Hannken-Illjes" <hannken@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54219 CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Date: Sun, 26 May 2019 10:23:00 +0000

 Module Name:	src
 Committed By:	hannken
 Date:		Sun May 26 10:22:59 UTC 2019

 Modified Files:
 	src/external/cddl/osnet/dist/uts/common/fs/zfs: vdev_disk.c

 Log Message:
 upport wedges as vdevs, use DIOCGWEDGEINFO before DIOCGPARTINFO.

 PR kern/54219 zpool create pool dk5 causes kernel panic


 To generate a diff of this commit:
 cvs rdiff -u -r1.8 -r1.9 \
     src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c

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

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.