From owner-freebsd-current Fri Aug 20 22:11:33 1999 Delivered-To: freebsd-current@freebsd.org Received: from cimlogic.com.au (cimlog.lnk.telstra.net [139.130.51.31]) by hub.freebsd.org (Postfix) with ESMTP id 44D7E15234 for ; Fri, 20 Aug 1999 22:11:25 -0700 (PDT) (envelope-from jb@cimlogic.com.au) Received: (from jb@localhost) by cimlogic.com.au (8.9.3/8.9.1) id PAA01667; Sat, 21 Aug 1999 15:11:42 +1000 (EST) (envelope-from jb) Date: Sat, 21 Aug 1999 15:11:41 +1000 From: John Birrell To: Luigi Rizzo Cc: Andrew Atrens , current@FreeBSD.ORG Subject: Re: problem with vnconfig -s labels ... Message-ID: <19990821151141.A281@freebsd1.cimlogic.com.au> References: <199908210222.EAA27932@labinfo.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.5i In-Reply-To: <199908210222.EAA27932@labinfo.iet.unipi.it>; from Luigi Rizzo on Sat, Aug 21, 1999 at 04:22:46AM +0200 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, Aug 21, 1999 at 04:22:46AM +0200, Luigi Rizzo wrote: > Hi, > > > I've found panics are more likely to occur if the command pair is > > executed in a script vs. from the command line. This may suggest some > > sort of race is occurring. > > no idea... i have always managed to panic the system even running the > commands from the command line one at a time, so i don't think it is a > race. > > I think i also got the paninc trying a disklabel when the "vn" device > was not in the kernel, but this one i had no time to reproduce. The problem is that disklabel executes code in subr_diskslice.c which does: dev1 = dkmodslice(dkmodpart(dev, RAW_PART), slice); The 'dev' structure has s_drv1 set correctly, but the 'dev1' entry has s_drv1 NULL. When vnstrategy() is called using dev1, vn = bp->b_dev->s_drv1 is NULL when it shouldn't be. The first time vn is referenced... fall down go boom. In my code (a bit similar to what picobsd is doing), I can open /dev/vn0, ioctl(fd,VNIOCATTACH,...), ioctl(fd,VNIOCUSET,...) and close without a problem. Execing '/sbin/disklabel -Brw /dev/rvn0 blah' causes the machine to panic. I've patched vnstrategy() to fail gracefully if bp->b_dev->s_drv1 is NULL, but I'm still looking for the place where the dev1 entry is supposed to be initialised. -- John Birrell - jb@cimlogic.com.au; jb@freebsd.org http://www.cimlogic.com.au/ CIMlogic Pty Ltd, GPO Box 117A, Melbourne Vic 3001, Australia +61 418 353 137 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message