NetBSD Problem Report #269

From gnats  Sun May 29 21:50:41 1994
Received: from relay.hp.com (relay.hp.com [15.255.152.2]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with SMTP id VAA26869 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Sun, 29 May 1994 21:50:41 -0700
Message-Id: <199405300450.AAA02233@sussex.hudson.ma>
Date: Mon, 30 May 1994 00:50:40 -0400
From: John Brezak <brezak@ch.hp.com>
Reply-To: brezak@ch.hp.com
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: buglet in [i386] /sys/scsi/sd.c
X-Send-Pr-Version: 3.2

>Number:         269
>Category:       port-i386
>Synopsis:       Default label for unlabelled disks sets fs_type to '9'. Check in open looks logic reversed.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 29 22:05:03 +0000 1994
>Closed-Date:    Wed Dec 28 20:35:20 +0000 1994
>Last-Modified:  
>Originator:     John Brezak
>Release:        0.9B
>Organization:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 John Brezak                    UUCP:     uunet!apollo.hp!brezak
 Hewlett Packard/Apollo         Internet: brezak@ch.hp.com
 300 Apollo Drive               Phone:    (508) 436-4915
 Chelmsford, Massachusetts      Fax:      (508) 436-5103
>Environment:

System: NetBSD sussex 0.9B NetBSD 0.9B (ESSEX) #26: Sat May 28 17:11:42 EDT 1994 brezak@sussex:/u0/src/netbsd/sys/arch/i386/compile/ESSEX i386


>Description:
When attempting to disklabel a fresh SCSI disk, the default label for the
'd' partition is created with a fs_type of 9. This probably should be a
FS_UNUSED. Also in the sdopen() routine there is a check if the partition
is 'd' and it is FS_UNUSED, then ENXIO. It seems that the login is reversed
in the check for FS_UNUSED. Otherwise how can you label an 'unused' partition ?

>How-To-Repeat:
Get a new disk. Try to label it with the default label, and use "disklabel -r -e"
to turn it into something more reasonable.
>Fix:

Here is a suggested fix, if this is suppose to be how it should work.

===================================================================
RCS file: /u1/CVS/netbsd/sys/scsi/sd.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 sd.c
*** 1.1.1.1	1994/05/30 03:47:41
--- sd.c	1994/05/30 04:34:02
***************
*** 276,282 ****
  	/*
  	 *  Check that the partition exists
  	 */
! 	if (sd->sc_dk.dk_label.d_partitions[part].p_fstype == FS_UNUSED &&
  	    part != RAW_PART) {
  		error = ENXIO;
  		goto bad;
--- 276,282 ----
  	/*
  	 *  Check that the partition exists
  	 */
! 	if (sd->sc_dk.dk_label.d_partitions[part].p_fstype != FS_UNUSED &&
  	    part != RAW_PART) {
  		error = ENXIO;
  		goto bad;
***************
*** 646,652 ****
  	sd->sc_dk.dk_label.d_partitions[0].p_offset = 0;
  	sd->sc_dk.dk_label.d_partitions[0].p_size =
  	    sd->params.disksize * (sd->params.blksize / DEV_BSIZE);
! 	sd->sc_dk.dk_label.d_partitions[0].p_fstype = 9;	/* XXXX */
  	sd->sc_dk.dk_label.d_partitions[RAW_PART].p_offset = 0;
  	sd->sc_dk.dk_label.d_partitions[RAW_PART].p_size =
  	    sd->params.disksize * (sd->params.blksize / DEV_BSIZE);
--- 646,652 ----
  	sd->sc_dk.dk_label.d_partitions[0].p_offset = 0;
  	sd->sc_dk.dk_label.d_partitions[0].p_size =
  	    sd->params.disksize * (sd->params.blksize / DEV_BSIZE);
! 	sd->sc_dk.dk_label.d_partitions[0].p_fstype = FS_UNUSED;
  	sd->sc_dk.dk_label.d_partitions[RAW_PART].p_offset = 0;
  	sd->sc_dk.dk_label.d_partitions[RAW_PART].p_size =
  	    sd->params.disksize * (sd->params.blksize / DEV_BSIZE);


	The first part of this patch is simply incorrect.  The was correct
	as is.  The second part is correct, and has already been done.
	- mycroft

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mycroft 
State-Changed-When: Wed Dec 28 12:35:20 PST 1994 
State-Changed-Why:  
Fixed. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.