diff options
author | cognet <cognet@FreeBSD.org> | 2005-09-21 15:01:09 +0000 |
---|---|---|
committer | cognet <cognet@FreeBSD.org> | 2005-09-21 15:01:09 +0000 |
commit | 2ccdc160835e64018bdc08fea7846d107b06d33f (patch) | |
tree | 28e3713e06f90f7ae6238f380bc98ef1a70d95ea /sys | |
parent | 4828c58b4857285085b8a68922229ecd6f1ae5d9 (diff) | |
download | FreeBSD-src-2ccdc160835e64018bdc08fea7846d107b06d33f.zip FreeBSD-src-2ccdc160835e64018bdc08fea7846d107b06d33f.tar.gz |
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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/vm/swap_pager.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index dc23576..a4ee9d6 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -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); |