NetBSD Problem Report #47989

From Wolfgang.Stukenbrock@nagler-company.com  Wed Jul  3 11:14:48 2013
Return-Path: <Wolfgang.Stukenbrock@nagler-company.com>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8C53870DED
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  3 Jul 2013 11:14:48 +0000 (UTC)
Message-Id: <20130703111436.862BC123B93@test-s0.nagler-company.com>
Date: Wed,  3 Jul 2013 13:14:36 +0200 (CEST)
From: Wolfgang.Stukenbrock@nagler-company.com
Reply-To: Wolfgang.Stukenbrock@nagler-company.com
To: gnats-bugs@gnats.NetBSD.org
Subject: raidframe open extracs disklabel even if there are wedges
X-Send-Pr-Version: 3.95

>Number:         47989
>Category:       kern
>Synopsis:       raidframe open extracs disklabel even if there are wedges
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 03 11:15:00 +0000 2013
>Closed-Date:    Mon Dec 22 13:09:32 +0000 2014
>Last-Modified:  Mon Dec 22 13:09:32 +0000 2014
>Originator:     Dr. Wolfgang Stukenbrock
>Release:        NetBSD 6.1
>Organization:
Dr. Nagler & Company GmbH
>Environment:


System: NetBSD test-s0 5.1.2 NetBSD 5.1.2 (NSW-WS) #3: Fri Dec 21 15:15:43 CET 2012 wgstuken@test-s0:/usr/src/sys/arch/amd64/compile/NSW-WS amd64
Architecture: x86_64
Machine: amd64
>Description:
	In src/sys/dev/raidframe/rf_netbsdkintf.c in function raidopen() there is check if we have
	wedges and than validate that the open reqquest goes to the RAW partition, but after that
	if the devides is INITED bug has dk_openmask==0, a none existing disklabel is read from disk.
	Useless error messages are printed by teh kernel
>How-To-Repeat:
	setup a raid device larger then 2TB with wedges. e.g. like this:
gpt destroy wd1
gpt create -f wd1
gpt add -t raid wd1
dkctl wd1 addwedge wd1_raid 34 7814037135 raid
gpt destroy wd3
gpt create -f wd3
gpt add -t raid wd3
dkctl wd3 addwedge wd3_raid 34 7814037135 raid

-- gpt show wd1 gives now:
       start        size  index  contents
           0           1         PMBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34  7814037101      1  GPT part - NetBSD RAIDFrame component
  7814037135          32         Sec GPT table
  7814037167           1         Sec GPT header
-- dkctl wd1 listwedges
/dev/rwd1d: 1 wedge:
dk0: wd1_raid, 7814037101 blocks at 34, type: raid
-- dkctl wd3 listwedges
/dev/rwd3d: 1 wedge:
dk1: wd3_raid, 7814037101 blocks at 34, type: raid
---

cat - >/tmp/r1_cfg << EOF
START array
1 2 0
START disks
/dev/dk0
/dev/dk1
START layout
128 1 1 1
START queue
fifo 200
EOF

raidctl -C /tmp/r1_cfg raid1
raidctl -I 12345 raid1
raidctl -i raid1
raidctl -A yes raid1

-- you will error messages like this from when running the raidctl comands (and the following one ...)
raid1: WARNING: raid1: total sector size in disklabel (3519069696) != the size of raid (7814036992)
---

gpt create -f raid1
gpt add -i 10 -t ffs raid1
dkctl raid1 addwedge raid1_g 34 7814036925 ffs

-- gpt show raid1
       start        size  index  contents
           0           1         PMBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34  7814036925     10  GPT part - NetBSD FFSv1/FFSv2
  7814036959          32         Sec GPT table
  7814036991           1         Sec GPT header
-- dkctl raid1 listwedges
/dev/rraid1d: 1 wedge:
dk2: raid1_g, 7814036925 blocks at 34, type: ffs
--
newfs -O2 /dev/rdk2         
mount /dev/dk2 /mnt
....
>Fix:
	The following patch will solve the Message problem after GPT partition table is initialized:

--- rf_netbsdkintf.c    2013/06/11 12:39:31     1.4
+++ rf_netbsdkintf.c    2013/07/03 09:24:43
@@ -1004,7 +1004,10 @@
        }
        pmask = (1 << part);

-       if ((rs->sc_flags & RAIDF_INITED) &&
+
+// remark: only try to get the disklabel if we do not have wedges ....
+       if ((rs->sc_dkdev.dk_nwedges == 0) &&
+           (rs->sc_flags & RAIDF_INITED) &&
            (rs->sc_dkdev.dk_openmask == 0))
                raidgetdisklabel(dev);

>Release-Note:

>Audit-Trail:
From: "Takahiro Kambe" <taca@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47989 CVS commit: src/sys/dev/raidframe
Date: Sun, 21 Dec 2014 17:04:12 +0000

 Module Name:	src
 Committed By:	taca
 Date:		Sun Dec 21 17:04:12 UTC 2014

 Modified Files:
 	src/sys/dev/raidframe: rf_netbsdkintf.c

 Log Message:
 Stop useless disklabel warning if there are wedges, using GPT partition.
 Fix PR kern/47989.

 XXX: Pullup 6 and 7 (maybe 5)


 To generate a diff of this commit:
 cvs rdiff -u -r1.316 -r1.317 src/sys/dev/raidframe/rf_netbsdkintf.c

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

From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47989 CVS commit: [netbsd-7] src/sys/dev/raidframe
Date: Mon, 22 Dec 2014 02:19:32 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Mon Dec 22 02:19:32 UTC 2014

 Modified Files:
 	src/sys/dev/raidframe [netbsd-7]: rf_netbsdkintf.c

 Log Message:
 Pull up following revision(s) (requested by taca in ticket #348):
 	sys/dev/raidframe/rf_netbsdkintf.c: revision 1.317
 Stop useless disklabel warning if there are wedges, using GPT partition.
 Fix PR kern/47989.
 XXX: Pullup 6 and 7 (maybe 5)


 To generate a diff of this commit:
 cvs rdiff -u -r1.312.2.3 -r1.312.2.4 src/sys/dev/raidframe/rf_netbsdkintf.c

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

From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47989 CVS commit: [netbsd-6] src/sys/dev/raidframe
Date: Mon, 22 Dec 2014 04:11:38 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Mon Dec 22 04:11:38 UTC 2014

 Modified Files:
 	src/sys/dev/raidframe [netbsd-6]: rf_netbsdkintf.c

 Log Message:
 Pull up following revision(s) (requested by taca in ticket #1216):
 	sys/dev/raidframe/rf_netbsdkintf.c: revision 1.317
 Stop useless disklabel warning if there are wedges, using GPT partition.
 Fix PR kern/47989.
 XXX: Pullup 6 and 7 (maybe 5)


 To generate a diff of this commit:
 cvs rdiff -u -r1.295.6.3 -r1.295.6.4 src/sys/dev/raidframe/rf_netbsdkintf.c

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

State-Changed-From-To: open->closed
State-Changed-By: msaitoh@NetBSD.org
State-Changed-When: Mon, 22 Dec 2014 13:09:32 +0000
State-Changed-Why:
Fixed and pulled up.
Thanks.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.