NetBSD Problem Report #525

From gnats  Tue Oct 18 19:15:44 1994
Received: from kaukau.comp.vuw.ac.nz (kaukau.comp.vuw.ac.nz [130.195.5.20]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id TAA02332 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Tue, 18 Oct 1994 19:15:28 -0700
Message-Id: <199410190225.PAA08052@orsinis.pc.comp.vuw.ac.nz>
Date: Wed, 19 Oct 1994 15:25:42 +1300
From: Duncan McEwan <duncan@Comp.VUW.AC.NZ>
Reply-To: duncan@Comp.VUW.AC.NZ
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: Access to the "a" partition of a mitsumi cd rom drive is broken
X-Send-Pr-Version: 3.2

>Number:         525
>Category:       port-i386
>Synopsis:       Access to the "a" partition of a mitsumi cd rom drive is broken
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 18 19:20:06 +0000 1994
>Closed-Date:    Fri Oct 28 23:40:08 +0000 1994
>Last-Modified:  
>Originator:     Duncan McEwan
>Release:        netbsd-current supp'ed around 15th October.
>Organization:
"	Computer Science Department, Victoria University of Wellington, NZ"
>Environment:
System: NetBSD orsinis.pc.comp.vuw.ac.nz 1.0_BETA NetBSD 1.0_BETA (ORSINIS) #15: Tue Oct 18 17:34:08 NZDT 1994 duncan@orsinis.pc.comp.vuw.ac.nz:/usr/src/sys/arch/i386/compile/ORSINIS i386

>Description:
	In a system with a mitsumi cd rom drive, running a kernel built with

		device mcd0 at isa? port 0x300 irq 10

	accessing /dev/mcd0a or /dev/rmcd0a doesn't work.  Ie

		orsinis# dd if=/dev/rmcd0a of=/dev/null
		0+0 records in
		0+0 records out
		0 bytes transferred in 1 secs (0 bytes/sec)

	and
		orsinis# mount -t cd9660 -r /dev/mcd0a /mnt
		cd9660: Invalid argument

	My mcd devices look like:

		br--r--r--  1 root  wheel    7,   0 Oct 15 00:21 /dev/mcd0a
		br--r--r--  1 root  wheel    7,   3 Oct 15 00:21 /dev/mcd0d
		cr--r--r--  1 root  wheel   39,   0 Oct 15 00:21 /dev/rmcd0a
		cr--r--r--  1 root  wheel   39,   3 Oct 15 00:21 /dev/rmcd0d

	The problem is that if you access a partition other than the raw ('d')
	one, mcdstrategy() calls i386/disksubr.c:bounds_check_with_label() to
	ensure that the requested transfer is within the bounds defined by the
	disk label.

	Bounds_check_with_label() sets maxsz of the (only) partition from
	mcdcd.cd_devs[0]->dlabel.d_partitions[0].p_size.  But this value is
	always zero, so maxsz - bp->b_blkno is always < 0.  Hence the immediate
	end of file when using "dd" and the EINVAL when trying to mount the
	disk.

	The reason the p_size field is always zero is that it is initialised
	from sc->disksize in mcd_getdisklabel(), which is called from mcdopen().
	Unfortunately, sc->disksize is itself initialised by a call to
	mcdsize() *after* the call to mcd_getdisklabel()...

>How-To-Repeat:
	As above.

>Fix:
	Two possible fixes:

	1) Get rid of the {r,}mcd0a devices, and document the fact that you
	   should only use /dev/mcd0d and /dev/rmcd0d.

	2) Apply the following patch which allows the {r,}mcd0a devices to work
	   as well (at least for me).

*** mcd.c.ORIG	Sun Aug  7 22:33:10 1994
--- mcd.c	Tue Oct 18 17:33:40 1994
***************
*** 238,251 ****
  	if (mcd_getstat(sc, 1) < 0)
  		return ENXIO;

- 	/* XXX Get a default disklabel. */
- 	mcd_getdisklabel(sc);
- 
  	if (mcdsize(dev) < 0) {
  		printf("%s: failed to get disk size\n", sc->sc_dev.dv_xname);
  		return ENXIO;
  	} else
  		sc->flags |= MCDVALID;

  	MCD_TRACE("open: partition=%d disksize=%d blksize=%d\n", part,
  	    sc->disksize, sc->blksize, 0);
--- 238,251 ----
  	if (mcd_getstat(sc, 1) < 0)
  		return ENXIO;

  	if (mcdsize(dev) < 0) {
  		printf("%s: failed to get disk size\n", sc->sc_dev.dv_xname);
  		return ENXIO;
  	} else
  		sc->flags |= MCDVALID;
+ 
+ 	/* XXX Get a default disklabel. */
+ 	mcd_getdisklabel(sc);

  	MCD_TRACE("open: partition=%d disksize=%d blksize=%d\n", part,
  	    sc->disksize, sc->blksize, 0);
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mycroft 
State-Changed-When: Fri Oct 28 16:40:08 PDT 1994 
State-Changed-Why:  
This, and several other things, are fixed. 
>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.