From 22470903a0567c16e282b40242f87a2929ac0aad Mon Sep 17 00:00:00 2001 From: David Greenman Date: Fri, 3 Mar 1995 22:13:16 +0000 Subject: [PATCH] Fixes from John Dyson to work around vnode lock hang. Basically, remove the VOP_BMAP calls, and add one to bdwrite. Submitted by: John Dyson --- sys/kern/vfs_bio.c | 19 +++++++++++-------- sys/ufs/ffs/ffs_alloc.c | 10 ++++++++-- sys/ufs/ffs/ffs_balloc.c | 4 +++- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index e1dea8e14431..437939900d27 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -18,7 +18,7 @@ * 5. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: vfs_bio.c,v 1.31 1995/02/25 01:46:26 davidg Exp $ + * $Id: vfs_bio.c,v 1.32 1995/03/01 22:08:55 davidg Exp $ */ /* @@ -187,9 +187,6 @@ bread(struct vnode * vp, daddr_t blkno, int size, struct ucred * cred, vfs_busy_pages(bp, 0); VOP_STRATEGY(bp); return (biowait(bp)); - } else if (bp->b_lblkno == bp->b_blkno) { - VOP_BMAP(vp, bp->b_lblkno, (struct vnode **) 0, - &bp->b_blkno, (int *) 0); } return (0); } @@ -223,9 +220,6 @@ breadn(struct vnode * vp, daddr_t blkno, int size, vfs_busy_pages(bp, 0); VOP_STRATEGY(bp); ++readwait; - } else if (bp->b_lblkno == bp->b_blkno) { - VOP_BMAP(vp, bp->b_lblkno, (struct vnode **) 0, - &bp->b_blkno, (int *) 0); } for (i = 0; i < cnt; i++, rablkno++, rabsize++) { if (inmem(vp, *rablkno)) @@ -332,6 +326,9 @@ bdwrite(struct buf * bp) bp->b_flags |= B_DONE | B_DELWRI; reassignbuf(bp, bp->b_vp); } + if( bp->b_lblkno == bp->b_blkno) { + VOP_BMAP(bp->b_vp, bp->b_lblkno, NULL, &bp->b_blkno, NULL); + } brelse(bp); return; } @@ -557,7 +554,8 @@ vfs_bio_awrite(struct buf * bp) * this is a possible cluster write */ if (ncl != 1) { - cluster_wbuild(vp, NULL, size, lblkno, ncl, -1); + bremfree(bp); + cluster_wbuild(vp, bp, size, lblkno, ncl, -1); splx(s); return; } @@ -647,6 +645,11 @@ getnewbuf(int slpflag, int slptimeo, int doingvmio) } goto start; } + + if( bp->b_flags & B_WANTED) { + bp->b_flags &= ~(B_WANTED|B_PDWANTED); + wakeup((caddr_t) bp); + } bremfree(bp); if (bp->b_flags & B_VMIO) { diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index dbffd8c35c03..0723bf268f6d 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_alloc.c 8.8 (Berkeley) 2/21/94 - * $Id: ffs_alloc.c,v 1.7 1995/02/14 06:14:28 phk Exp $ + * $Id: ffs_alloc.c,v 1.8 1995/02/27 17:43:57 se Exp $ */ #include @@ -198,6 +198,13 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp) brelse(bp); return (error); } + + if( bp->b_blkno == bp->b_lblkno) { + if( lbprev >= NDADDR) + panic("ffs_realloccg: lbprev out of range"); + bp->b_blkno = fsbtodb(fs, bprev); + } + #ifdef QUOTA error = chkdq(ip, (long)btodb(nsize - osize), cred, 0); if (error) { @@ -273,7 +280,6 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp) (u_long (*)())ffs_alloccg); if (bno > 0) { bp->b_blkno = fsbtodb(fs, bno); - /* (void) vnode_pager_uncache(ITOV(ip)); */ ffs_blkfree(ip, bprev, (long)osize); if (nsize < request) ffs_blkfree(ip, bno + numfrags(fs, nsize), diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c index fbbbc436a7f8..83a9328ff6e3 100644 --- a/sys/ufs/ffs/ffs_balloc.c +++ b/sys/ufs/ffs/ffs_balloc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_balloc.c 8.4 (Berkeley) 9/23/93 - * $Id: ffs_balloc.c,v 1.3 1994/08/02 07:54:18 davidg Exp $ + * $Id: ffs_balloc.c,v 1.4 1994/10/10 01:04:36 phk Exp $ */ #include @@ -113,6 +113,7 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) brelse(bp); return (error); } + bp->b_blkno = fsbtodb(fs, nb); *bpp = bp; return (0); } @@ -128,6 +129,7 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) brelse(bp); return (error); } + bp->b_blkno = fsbtodb(fs, nb); } else { error = ffs_realloccg(ip, bn, ffs_blkpref(ip, bn, (int)bn, &ip->i_db[0]),