NetBSD Problem Report #38735

From jakllsch@wormulon.kollasch.net  Sat May 24 15:36:54 2008
Return-Path: <jakllsch@wormulon.kollasch.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id BF3B263BBCF
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 24 May 2008 15:36:53 +0000 (UTC)
Message-Id: <20080524153651.D77C644DC6@wormulon.kollasch.net>
Date: Sat, 24 May 2008 15:36:51 +0000 (UTC)
From: jakllsch@kollasch.net
Reply-To: jakllsch@kollasch.net
To: gnats-bugs@gnats.NetBSD.org
Subject: cgd on dk
X-Send-Pr-Version: 3.95

>Number:         38735
>Category:       kern
>Synopsis:       cgd can't be backed by dk (patch)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 24 15:40:01 +0000 2008
>Closed-Date:    Tue Mar 24 22:02:49 +0000 2009
>Last-Modified:  Tue Mar 24 22:02:49 +0000 2009
>Originator:     Jonathan A. Kollasch
>Release:        NetBSD 4.99.58
>Organization:
>Environment:


System: NetBSD wormulon.kollasch.net 4.99.58 NetBSD 4.99.58 (WORMULON) #14: Thu May 22 14:22:56 UTC 2008 root@wormulon.kollasch.net:/usr/src/sys/arch/amd64/compile/WORMULON amd64
Architecture: x86_64
Machine: amd64
>Description:
cgd can't be configured on a disk wedge.
>How-To-Repeat:
try to cgdconfig on a dk(4)

>Fix:

Index: cgd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/cgd.c,v
retrieving revision 1.51
diff -u -r1.51 cgd.c
--- cgd.c	21 Mar 2008 21:54:59 -0000	1.51
+++ cgd.c	24 May 2008 15:29:56 -0000
@@ -611,15 +611,18 @@
 {
 	struct	dk_geom *pdg;
 	struct	partinfo dpart;
+	struct	dkwedge_info dkw;
 	struct	vattr va;
 	size_t	size;
-	int	maxsecsize = 0;
+//	int	maxsecsize = 0;
 	int	ret;
 	char	*tmppath;

 	cs->sc_dksc.sc_size = 0;
 	cs->sc_tvn = vp;
 	cs->sc_tpath = NULL;
+	
+	size = 0;

 	tmppath = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
 	ret = copyinstr(cpath, tmppath, MAXPATHLEN, &cs->sc_tpathlen);
@@ -634,13 +637,19 @@
 	cs->sc_tdev = va.va_rdev;

 	ret = VOP_IOCTL(vp, DIOCGPART, &dpart, FREAD, l->l_cred);
-	if (ret)
-		goto bail;
+	if (ret == 0)
+		size = dpart.part->p_size;
+	ret = VOP_IOCTL(vp, DIOCGWEDGEINFO, &dkw, FREAD, l->l_cred);
+	if (ret == 0)
+		size = dkw.dkw_size;

+
+#if 0
 	maxsecsize =
 	    ((dpart.disklab->d_secsize > maxsecsize) ?
 	    dpart.disklab->d_secsize : maxsecsize);
 	size = dpart.part->p_size;
+#endif

 	if (!size) {
 		ret = ENODEV;


some notes on the patch:
'int maxsecsize' seemed to be a dead variable.

>Release-Note:

>Audit-Trail:
From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/38735 CVS commit: src/sys/dev
Date: Fri, 21 Nov 2008 20:14:20 +0000 (UTC)

 Module Name:	src
 Committed By:	christos
 Date:		Fri Nov 21 20:14:20 UTC 2008

 Modified Files:
 	src/sys/dev: cgd.c

 Log Message:
 PR/38735: Jonathan A. Kollasch: cgd cannot be used on top of wedges


 To generate a diff of this commit:
 cvs rdiff -r1.53 -r1.54 src/sys/dev/cgd.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->pending-pullups
State-Changed-By: jakllsch@NetBSD.org
State-Changed-When: Sun, 23 Nov 2008 01:51:02 +0000
State-Changed-Why:
pullup-5 #111


From: Jeff Rizzo <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/38735 CVS commit: [netbsd-5] src/sys/dev
Date: Sun, 23 Nov 2008 21:10:46 +0000 (UTC)

 Module Name:	src
 Committed By:	riz
 Date:		Sun Nov 23 21:10:46 UTC 2008

 Modified Files:
 	src/sys/dev [netbsd-5]: cgd.c

 Log Message:
 Pull up following revision(s) (requested by jakllsch in ticket #111):
 	sys/dev/cgd.c: revision 1.54
 PR/38735: Jonathan A. Kollasch: cgd cannot be used on top of wedges


 To generate a diff of this commit:
 cvs rdiff -r1.53 -r1.53.4.1 src/sys/dev/cgd.c

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

State-Changed-From-To: pending-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 24 Mar 2009 22:02:49 +0000
State-Changed-Why:
pullup done in november.


>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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.