summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1995-03-03 22:13:16 +0000
committerdg <dg@FreeBSD.org>1995-03-03 22:13:16 +0000
commit9dc7842c2577b5a88d023b5f5f373da763756b95 (patch)
tree9a2e43799ccdccaddab12d214c25f69027d8d3e7
parent78929da63cab7ac0a2bcc42e1c8e402e501f9434 (diff)
downloadFreeBSD-src-9dc7842c2577b5a88d023b5f5f373da763756b95.zip
FreeBSD-src-9dc7842c2577b5a88d023b5f5f373da763756b95.tar.gz
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
-rw-r--r--sys/kern/vfs_bio.c19
-rw-r--r--sys/ufs/ffs/ffs_alloc.c10
-rw-r--r--sys/ufs/ffs/ffs_balloc.c4
3 files changed, 22 insertions, 11 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index e1dea8e..4379399 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 @@ trytofreespace:
}
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 dbffd8c..0723bf2 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 <sys/param.h>
@@ -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 fbbbc43..83a9328 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 <sys/param.h>
@@ -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]),
OpenPOWER on IntegriCloud