Subject: more serious vnd bug
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: current-users
Date: 07/25/1996 17:44:15
I just had another run-in with the vnd driver.

I have a filesystem image in a file and I wanted to fsck it,
preparatory to doing more with it.  So I

# vnconfig -c /dev/rvnd0c /mnt/callisto-sd0f-dd

and it was happy.  But then when I

# fsck /dev/rvnd0c

boom, down we go, with a dk_busy < 0 panic from disk_unbusy.  This
turned out to be repeatable in practice.  A quick look at the disk_busy
and disk_unbusy calls in vnd.c didn't turn up anything obviously wrong.

So I set vnddebug to 7 (ie, all useful bits on) and hacked it to hang,
rather than breaking to ddb and thereby scribbling all over the screen,
when this happens.  And here's what I saw.  (The rastercons code left
some stray cursor images on the screen; I've replaced them with @ signs
below.  @ does not occur otherwise.)  It looks at first blush as though
a buffer (f866b600 below) is somehow having its I/O complete twice.  I
think what's actually happening is that the "if (error)" inside the
loop in vndstrategy is tripping, which leads to biodone calling
vndiodone calling disk_unbusy on a buffer that never got a disk_busy
call.

This seems to me like a definite bug in the vnd driver.  (I also find
myself wondering why VOP_BMAP is failing at the relevant point, but
that's a completely different point, and probably isn't vnd's fault.)

Here's a ten-finger copy of the output.  At most a couple of lines got
lost off the top, and I think they are probably unimportant.  Note that
some of the output comes from fsck.

vndopen(6e02, 2, 2000, 0xf8672c00)
** /dev/rvnd0c
vndioctl(6e02, 41146465, 0xf8662c00, 1, 0xf8672c00): unit 0
vndread(6e02, 0xf9938e98)
vndstrategy(0xf8bf0938): unit 0
vndstrategy: vp 0xf8639c00/0xf8643c00 bn 2000/2d0 sz 2000
vndstart(0): bp 0xf866bb80 vp 0xf8643c00 blkno 2d0 addr 0xf9939000 cnt 2000
vndiodone(0): vbp 0xf866bb80 vp 0xf8643c00 blkno 2d0 addr 0xf9939000 cnt 2000
vndiodone: pbp 0xf8bf0938 iodone
vndread(6e02, 0xf9938e98)
vndstrategy(0xf8bf0938): unit 0
vndstrategy: vp 0xf8639c00/0xf8643c00 bn 375f4000/8ab00 sz 800
vndstart(0): bp 0xf866b800 vp 0xf8643c00 blkno 8ab00 addr 0xf9939000 cnt 800
vndiodone(0): vbp 0xf866b800 vp 0xf8643c00 blkno 8ab00 addr 0xf9939000 cnt 800
vndiodone: pbp 0xf8bf0938 iodone
** File system is already clean
vndread(6e02, 0xf9938e98)
vndstrategy(0xf8bf0938): unit 0
vndstrategy: vp 0xf8639c00/0xf8643c00 bn 4ec00/a010 sz c00
vndstart(0): bp 0xf866b700 vp 0xf8643c00 blkno a016 addr 0xf9939000 cnt c00
vndiodone(0): bp 0xf866b700 vp 0xf8643c00 blkno a016 addr 0xf9939000 cnt c00
vndiodone: pbp 0xf8bf0938 iodone
** Last Mounted on /space
** Phase 1 - Check Blocks and Sizes
vndread(6e02, 0xf9938e98)
vndstrategy(0xf8bf0938): unit 0
vndstrategy: vp 0xf8639c00/0xf8643c00 bn 8000/300 sz 4000
vndstart(0): bp 0xf8666e80 vp 0xf8643c00 blkno 300 addr f9939000 cnt 4000
vndiodone(0): vbp 0xf8666e80 vp 0xf8643c00 blkno 300 addr f9939000 cnt 4000
@
vndstart(0): bp 0xf866bd80 vp 0xf8643c00 blkno 320 addr f993d000 cnt 4000
vndstrategy: vp 0xf8639c00/0vndiodone(0): vbp 0xf866bd80 vp 0xf8643c00 blkno 320 addr 0xf993d000 cnd 4000
xf8643c00 bn 10000/340 sz 4000
vndstart(0): bp 0xf866bb80 vp 0xf8643c00 blkno 340 addr 0xf9941000 cnt 4000
vndiodone(0): vbp 0xf866bb80 vp 0xf8643c00 blkno 340 addr 0xf9941000 cnt 4000
@
vndstart(0): bp 0xf866b600 vp 0xf8643c00 blkno 360 addr 0xf9945000 cnt 2000
vndiodone(0): vbp 0xf866b600 vp 0xf8643c00 blkno 360 addr 0xf9945000 cnt 2000
vndiodone: pbp 0xf8bf0938 iodone
vndread(6e02, 0xf9938e98)
vndstrategy(0xf8bf0938): unit 0
vndstrategy: vp 0xf8639c00/0xf8643c00 bn 16000/370 sz 2000
vndstart(0): bp 0xf866b580 vp 0xf8643c00 blkno 370 addr 0xf9939000 cnt 2000
vndstrategy: vpvndiodone(0): bp 0xf866b580 vp 0xf8643c00 blkno 370 addr 0xf9939000 cnt 2000
 0xf8639c00/0xf8643c00 bn 18000/4fd0 sz 4000
vndstart(0): bp 0xf866b800 vp 0xf8643c00 blkno 4fd0 addr 0xf993b000 cnt 4000
vndiodone(0): vbp 0xf866b800 vp 0xf8643c00 blkno 4fd0 addr 0xf993b000 cnt 4000
@
vndstart(0): bp 0xf866b700 vp 0xf8643c00 blkno 4ff0 addr 0xf993f000 cnt 4000
vndstrategy: vp 0xf8639c00/0vndiodone(0): vbp 0xf866b700 vp 0xf8643c00 blkno 4ff0 addr 0xf993f000 cnt 4000
xf8643c00 bn 20000/5010 sz 4000
vndstart(0): bp 0xf8666e80 vp 0xf8643c00 blkno 5010 addr 0xf9943000 cnt 4000
vndiodone(0): vbp 0xf8666e80 vp 0xf8643c00 blkno 5010 addr 0xf9943000 cnt 4000
vndiodone: pbp 0xf8bf0938 iodone
vndread(6e02, 0xf9938e98)
vndstrategy(0xf8bf0938): unit 0
vndstrategy: vp 0xf8639c00/0xf8643c00 bn 1ea2000/29e50 sz 2000
vndstart(0): bp 0xf866bd80 vp 0xf8643c00 blkno 29e50 addr 0xf9949000 cnt 2000
vndiodone(0): vbp 0xf866bd80 vp 0xf8643c00 blkno 29e50 addr 0xf9949000 cnt 2000
vndiodone: pbp 0xf8bf0938 iodone
vndread(6e02, 0xf9938e98)
vndstrategy(0xf8bf0938): unit 0
vndstrategy: vp 0xf8639c00/0xf8643c00 bn 24000/52b0 sz 2000
vndstart(0): bp 0xf866bb80 vp 0xf8643c00 blkno 52b0 addr 0xf9939000 cnt 2000
vndstrategy: vp 0xf8639c00/0xf8643c00 bn 26000/ffffvndiodone(0): bp 0xf866bb80 vp 0xf8643c00 blkno 52b0 addr 0xf9939000 cnt 2000
f000 sz 2000                                       @
vndiodone(0): vbp 0xf866b600 vp 0xf8643c00 blkno ffffffff addr 0xf993b000 cnt 2000
vndiodone: vbp f866b600 error 5

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu
		    01 EE 31 F6 BB 0C 34 36  00 F3 7C 5A C1 A0 67 1D