Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Aug 1999 15:11:41 +1000
From:      John Birrell <jb@cimlogic.com.au>
To:        Luigi Rizzo <luigi@labinfo.iet.unipi.it>
Cc:        Andrew Atrens <atrens@nortelnetworks.com>, current@FreeBSD.ORG
Subject:   Re: problem with vnconfig -s labels ...
Message-ID:  <19990821151141.A281@freebsd1.cimlogic.com.au>
In-Reply-To: <199908210222.EAA27932@labinfo.iet.unipi.it>; from Luigi Rizzo on Sat, Aug 21, 1999 at 04:22:46AM %2B0200
References:  <Pine.HPX.4.10.9908201402530.2361-100000@wmerh01z> <199908210222.EAA27932@labinfo.iet.unipi.it>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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