Make sure we have a bufobj before calling bstrategy().

I'm not sure this is the right thing to do, but at least I don't panic
anymore when swapping on a NFS file without using md(4).

X-MFC after:      proper review
This commit is contained in:
Olivier Houchard 2005-09-21 15:01:09 +00:00
parent cb74d4b2b4
commit 3cfc7651b2

View File

@ -2475,10 +2475,12 @@ swapdev_strategy(struct buf *bp, struct swdevt *sp)
vp2 = sp->sw_id;
vhold(vp2);
if (bp->b_iocmd == BIO_WRITE) {
if (bp->b_bufobj) /* XXX: should always be true /phk */
if (bp->b_bufobj)
bufobj_wdrop(bp->b_bufobj);
bufobj_wref(&vp2->v_bufobj);
}
if (bp->b_bufobj != &vp2->v_bufobj)
bp->b_bufobj = &vp2->v_bufobj;
bp->b_vp = vp2;
bp->b_iooffset = dbtob(bp->b_blkno);
bstrategy(bp);