Date: Mon, 13 Oct 1997 13:20:42 +0200 From: Poul-Henning Kamp <phk@critter.freebsd.dk> To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) Cc: freebsd-current@FreeBSD.ORG (FreeBSD-current users) Subject: Re: lockmgr panic Message-ID: <26001.876741642@critter.freebsd.dk> In-Reply-To: Your message of "Mon, 13 Oct 1997 08:41:58 %2B0200." <19971013084158.HG40991@uriah.heep.sax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
I belive you hit "the other" recursive condition in vn, which is the
one we have no fix for I belive. The closest we could get would be
to just queue the second buffer in vnstrategy() if we're already
active, but then it may simply convert to a deadlock...
I hacked this little "genuine ram disk driver" up a couple of days ago,
if should do everything you would want to have done if this is for release
building:
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id$
*
*/
#ifndef RD0_SIZE
#define RD0_SIZE (80*2*18*512)
#endif
/*
* Includes
*/
#include "rd.h"
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/buf.h>
#include <sys/disklabel.h>
#include <sys/diskslice.h>
/*
* Prototypes
*/
static d_open_t rdopen;
static d_close_t rdclose;
static d_strategy_t rdstrategy;
static d_ioctl_t rdioctl;
static d_dump_t rddump;
static d_psize_t rdsize;
/*
* Data
*/
static
struct rd_softc {
unsigned long sc_size;
u_char *sc_base;
struct diskslices *sc_slices;
} softc[NRD];
#ifdef RD0_SIZE
static u_char rd0_data[RD0_SIZE] = "RD0 Image goes here";
#endif /* RD0_SIZE */
/*
* Registation into the kernel data structures
*/
#define BDEV_MAJOR 24
#define CDEV_MAJOR 84
static struct cdevsw rd_cdevsw;
static struct bdevsw rd_bdevsw =
{ rdopen, rdclose, rdstrategy, rdioctl, rddump, rdsize,
D_DISK, "rd", &rd_cdevsw, -1 };
static void
rd_drvinit(void *unused)
{
bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &rd_bdevsw);
#ifdef RD0_SIZE
softc[0].sc_base = rd0_data;
softc[0].sc_size = RD0_SIZE;
#endif /* RD0_SIZE */
}
SYSINIT(rddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,rd_drvinit,NULL)
static int
rdopen(dev_t dev, int flags, int mode, struct proc *p)
{
struct rd_softc *sc;
struct disklabel label;
int error;
sc = softc + dkunit(dev);
bzero(&label, sizeof label);
label.d_secsize = DEV_BSIZE;
label.d_nsectors = sc->sc_size / DEV_BSIZE;
label.d_ntracks = 1;
label.d_ncylinders = 1;
label.d_secpercyl = label.d_nsectors;
label.d_secperunit = label.d_nsectors;
error = dsopen("rd", dev, mode, &sc->sc_slices, &label, rdstrategy,
(ds_setgeom_t *)NULL, &rd_bdevsw, &rd_cdevsw);
return (error);
}
static int
rdclose(dev_t dev, int flags, int mode, struct proc *p)
{
struct rd_softc *sc;
sc = softc + dkunit(dev);
dsclose(dev, mode, sc->sc_slices);
return (0);
}
static void
rdstrategy(struct buf *bp)
{
struct rd_softc *sc;
u_char *where;
sc = softc + dkunit(bp->b_dev);
bp->b_resid = bp->b_bcount;
if (dscheck(bp, sc->sc_slices) <= 0) {
biodone(bp);
return;
}
where = sc->sc_base + dbtob(bp->b_pblkno);
if (bp->b_flags & B_READ) {
bcopy(where , bp->b_data, bp->b_bcount);
} else {
bcopy(bp->b_data, where, bp->b_bcount);
}
bp->b_resid -= bp->b_bcount;
biodone(bp);
}
static int
rdioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
{
struct rd_softc *sc;
int error;
sc = softc + dkunit(dev);
error = dsioctl("rd", dev, cmd, data, flag, &sc->sc_slices,
rdstrategy, (ds_setgeom_t *)NULL);
if (error == -1)
error = ENOTTY;
return (error);
}
static int
rddump(dev_t dev)
{
return (ENODEV);
}
static int
rdsize(dev_t dev)
{
return (0);
}
--
Poul-Henning Kamp FreeBSD coreteam member
phk@FreeBSD.ORG "Real hackers run -current on their laptop."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?26001.876741642>
