Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Dec 2004 12:48:46 +0900
From:      Pyun YongHyeon <yongari@kt-is.co.kr>
To:        "Ballance, Robert T" <tyler@neo.tamu.edu>
Cc:        freebsd-sparc64@freebsd.org
Subject:   Re: sysinstall dead in -CURRENT?
Message-ID:  <20041222034846.GA8065@kt-is.co.kr>
In-Reply-To: <20041221071417.GA5301@kt-is.co.kr>
References:  <20041221025023.GB4468@kt-is.co.kr> <200412210643.iBL6hHEK085224@smtp-relay.tamu.edu> <20041221071417.GA5301@kt-is.co.kr>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 21, 2004 at 04:14:17PM +0900, To Ballance, Robert T wrote:
 > On Tue, Dec 21, 2004 at 06:43:17AM -0000, Ballance, Robert T wrote:
 >  > > AFAIK, this has nothing to do with marius' zs(4) patch.
 >  > > There is also PR72962 for the issue.
 >  > > 
 >  > > Long ago, I made a patch for this issue. But it wasn't further
 >  > > investigated due to lack of time. I sent a mail to one of
 >  > > developer but got no reply. The following is the summary of
 >  > > the mail.
 >  > > 
 >  > > It seems that it happans on on systems with SCSI CDROM. In rev.
 >  > > 1.90 of scsi_cd.c, phk changed to return 2k sectors when no media
 >  > > inserted. But open_disk.c:Int_Open_Disk() just check sectorsize
 >  > > against 0. So if we have no media in CDROM, we would bypass the
 >  > > check and could generate division by zero exception. I guess we
 >  > > need at least the following patch.
 >  > > 
 >  > > It seems that there are two cases here.
 >  > > 1. No media in CDROM -> sector = 2k, hd = 0
 >  > > 2. media present in CDROM -> sector = 0, hd = 0
 >  > > 
 >  > > --- open_disk.c.orig	Mon Sep 20 11:22:10 2004
 >  > > +++ open_disk.c	Tue Oct 26 17:45:17 2004
 >  > > @@ -94,6 +94,8 @@
 >  > >  		return (NULL);
 >  > >  	d->sector_size = s;
 >  > >  	len /= s;	/* media size in number of sectors. */
 >  > > +	if (len == 0)
 >  > > +		return (NULL);
 >  > >  
 >  > >  	if (Add_Chunk(d, 0, len, name, whole, 0, 0, "-")) {
 >  > >  		DPRINT(("Failed to add 'whole' chunk"));
 >  > > @@ -123,6 +125,10 @@
 >  > >  	 */
 >  > >  	o = d->bios_hd * d->bios_sect;
 >  > >  	d->bios_cyl = (o != 0) ? len / o : 0;
 >  > > +	if (d->bios_cyl == 0) {
 >  > > +		/* XXX This may indicate it is not DISK. */
 >  > > +		return (NULL);
 >  > > +	}
 >  > >  
 >  > >  	p = q;
 >  > >  	lo[0] = 0;
 >  > > 
 >  > > And another one to plug memory leak.
 >  > > 
 >  > > --- disk.c.orig	Mon May 17 07:08:16 2004
 >  > > +++ disk.c	Tue Oct 26 16:46:23 2004
 >  > > @@ -77,6 +77,7 @@
 >  > >  struct disk *
 >  > >  Open_Disk(const char *name)
 >  > >  {
 >  > > +	struct disk *d;
 >  > >  	char *conftxt;
 >  > >  	size_t txtsize;
 >  > >  	int error;
 >  > > @@ -99,7 +100,10 @@
 >  > >  	}
 >  > >  	conftxt[txtsize] = '';	/* in case kernel bug is still there */
 >  > >  
 >  > > -	return Int_Open_Disk(name, conftxt);
 >  > > +	d = Int_Open_Disk(name, conftxt);
 >  > > +	free(conftxt);
 >  > > +
 >  > > +	return (d);
 >  > >  }
 >  > >  
 >  > >  void
 >  > > 
 >  > > BTW, I don't know why GEOM thinks SCSI CDROM as a disk. On systems
 >  > > with IDE CDROM, it is not considered as a disk. So above problem
 >  > > only happen on systems with SCSI CDROM. With above patches my U2
 >  > > displayed install screen successfully with/without CD mdia in CDROM.
 >  > 
 >  > Is there anything I can do to help get this into the tree/working, and does this problem affect SCSI 
 >  > cdrom's across the board,  or just with sparc64?
 >  > 
 > 
 > I guess it happens only on sparc64 with SCSI CDROM.
 > The patch I posted would be just a work-around, not fix. Why sysinstall
 > thinks CDROM as a disk target would be the root cause.
 > 
 >  > I'm off for a good while from University, and I got access today to another Ultra2 and an Ultra60, so I 
 >  > can test more stuff if needed ;)
 >  > 
 > 
 > I'd like to see real fix too.
 > 

Ok, here is a better workaround. This patch should also fix another
error of sysinstall. At present, sysinstall presents SCSI CDROM
to available disks in Fdisk/Label menu. It seems that the root
cause is GEOM's disk handling.("kern.disk" always shows SCSI CDROM
and it is used as an argument to Open_Disk())

So I added an additioanl check for CDROM in sysinstall instead of
touching libdisk. Please let me know how it goes. And I'd like
to know it doesn't break i386 sysinstall too. Due to lack of i386 with
SCSI CDROM I couldn't verify the patch.

 >  > -R. Tyler Ballance
 >  > 
 >  > 
 > 
--- usr.sbin/sysinstall/devices.c.orig	Mon Nov 29 12:55:28 2004
+++ usr.sbin/sysinstall/devices.c	Wed Dec 22 12:37:08 2004
@@ -457,6 +457,20 @@
 	    if (!strncmp(names[i], "md", 2))
 		continue;
 
+	    /*
+	     * XXX 
+	     *  Due to unknown reasons, Disk_Names() returns SCSI CDROM as a
+	     * valid disk. This is main reason why sysinstall presents SCSI
+	     * CDROM to available disks in Fdisk/Label menu. In addition,
+	     * adding a blank SCSI CDROM to the menu generates floating point
+	     * exception in sparc64. Disk_Names() just extracts sysctl
+	     * "kern.disks". Why GEOM treats SCSI CDROM as a disk is beyond
+	     * me and that should be investigated.
+	     * For temporary workaround, ignore SCSI CDROM.
+	     */
+	    if (!strncmp(names[i], "cd", 2))
+		continue;
+
 	    d = Open_Disk(names[i]);
 	    if (!d) {
 		msgDebug("Unable to open disk %s\n", names[i]);
-- 
Regards,
Pyun YongHyeon
http://www.kr.freebsd.org/~yongari	|	yongari@freebsd.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041222034846.GA8065>