diff options
author | jeff <jeff@FreeBSD.org> | 2003-08-31 08:50:11 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2003-08-31 08:50:11 +0000 |
commit | 86f70ead2114c0de8a016de4bb047d9ad8aeaf69 (patch) | |
tree | 8f00b473657a626826ca739d2ef725324497092d /sys/ufs | |
parent | d4a07597ca9fdc4cbb2b3a8176ec14dca7b7f96e (diff) | |
download | FreeBSD-src-86f70ead2114c0de8a016de4bb047d9ad8aeaf69.zip FreeBSD-src-86f70ead2114c0de8a016de4bb047d9ad8aeaf69.tar.gz |
- Define a new flag for getblk(): GB_NOCREAT. This flag causes getblk() to
bail out if the buffer is not already present.
- The buffer returned by incore() is not locked and should not be sent to
brelse(). Use getblk() with the new GB_NOCREAT flag to preserve the
desired semantics.
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_softdep.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 429f98f..6ea776a 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -2563,10 +2563,10 @@ indir_trunc(freeblks, dbn, level, lbn, countp) * a complete copy of the indirect block in memory for our use. * Otherwise we have to read the blocks in from the disk. */ + bp = getblk(freeblks->fb_devvp, dbn, (int)fs->fs_bsize, 0, 0, + GB_NOCREAT); ACQUIRE_LOCK(&lk); - /* XXX Buf not locked! */ - if ((bp = incore(freeblks->fb_devvp, dbn)) != NULL && - (wk = LIST_FIRST(&bp->b_dep)) != NULL) { + if (bp != NULL && (wk = LIST_FIRST(&bp->b_dep)) != NULL) { if (wk->wk_type != D_INDIRDEP || (indirdep = WK_INDIRDEP(wk))->ir_savebp != bp || (indirdep->ir_state & GOINGAWAY) == 0) { @@ -2582,6 +2582,8 @@ indir_trunc(freeblks, dbn, level, lbn, countp) VFSTOUFS(freeblks->fb_mnt)->um_numindirdeps -= 1; FREE_LOCK(&lk); } else { + if (bp) + brelse(bp); FREE_LOCK(&lk); error = bread(freeblks->fb_devvp, dbn, (int)fs->fs_bsize, NOCRED, &bp); |