diff options
author | mckusick <mckusick@FreeBSD.org> | 1999-03-02 06:38:07 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 1999-03-02 06:38:07 +0000 |
commit | 4806ae523d1705fc6df04473fa4146f8e8b17b38 (patch) | |
tree | 5671e66f11aecdaad4d42248733221bdbc1e7e85 /contrib | |
parent | eb53d4fbfc10acebc225c09d10d4394c12d93076 (diff) | |
download | FreeBSD-src-4806ae523d1705fc6df04473fa4146f8e8b17b38.zip FreeBSD-src-4806ae523d1705fc6df04473fa4146f8e8b17b38.tar.gz |
Reorganize locking to avoid holding the lock during calls to bdwrite
and brelse (which may sleep in some systems).
Obtained from: Matthew Dillon <dillon@apollo.backplane.com>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/sys/softupdates/ffs_softdep.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/contrib/sys/softupdates/ffs_softdep.c b/contrib/sys/softupdates/ffs_softdep.c index d408068..a5fe8a8 100644 --- a/contrib/sys/softupdates/ffs_softdep.c +++ b/contrib/sys/softupdates/ffs_softdep.c @@ -52,8 +52,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)ffs_softdep.c 9.33 (McKusick) 2/25/99 - * $Id: ffs_softdep.c,v 1.22 1999/02/17 20:01:20 mckusick Exp $ + * from: @(#)ffs_softdep.c 9.34 (McKusick) 3/1/99 + * $Id: ffs_softdep.c,v 1.23 1999/03/02 00:19:47 mckusick Exp $ */ /* @@ -1649,6 +1649,7 @@ softdep_setup_freeblocks(ip, length) merge_inode_lists(inodedep); while ((adp = TAILQ_FIRST(&inodedep->id_inoupdt)) != 0) free_allocdirect(&inodedep->id_inoupdt, adp, 1); + FREE_LOCK(&lk); bdwrite(bp); /* * We must wait for any I/O in progress to finish so that @@ -1657,6 +1658,7 @@ softdep_setup_freeblocks(ip, length) * any dependencies. */ vp = ITOV(ip); + ACQUIRE_LOCK(&lk); while (vp->v_numoutput) { vp->v_flag |= VBWAIT; FREE_LOCK_INTERLOCKED(&lk); @@ -1668,7 +1670,9 @@ softdep_setup_freeblocks(ip, length) (void) inodedep_lookup(fs, ip->i_number, 0, &inodedep); deallocate_dependencies(bp, inodedep); bp->b_flags |= B_INVAL | B_NOCACHE; + FREE_LOCK(&lk); brelse(bp); + ACQUIRE_LOCK(&lk); } /* * Try freeing the inodedep in case that was the last dependency. @@ -2150,17 +2154,19 @@ softdep_setup_directory_add(bp, dp, diroffset, newinum, newdirbp) mkdir2->md_list.wk_type = D_MKDIR; mkdir2->md_state = MKDIR_PARENT; mkdir2->md_diradd = dap; - ACQUIRE_LOCK(&lk); /* * Dependency on "." and ".." being written to disk. */ mkdir1->md_buf = newdirbp; + ACQUIRE_LOCK(&lk); LIST_INSERT_HEAD(&mkdirlisthd, mkdir1, md_mkdirs); WORKLIST_INSERT(&newdirbp->b_dep, &mkdir1->md_list); + FREE_LOCK(&lk); bdwrite(newdirbp); /* * Dependency on link count increase for parent directory */ + ACQUIRE_LOCK(&lk); if (inodedep_lookup(dp->i_fs, dp->i_number, 0, &inodedep) == 0 || (inodedep->id_state & ALLCOMPLETE) == ALLCOMPLETE) { dap->da_state &= ~MKDIR_PARENT; |