summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/ufs/ffs/ffs_softdep.c218
1 files changed, 165 insertions, 53 deletions
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index a5e663a4fb8..fde639b057f 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_softdep.c,v 1.14 2001/02/24 19:07:09 csapuntz Exp $ */
+/* $OpenBSD: ffs_softdep.c,v 1.15 2001/02/26 17:43:34 csapuntz Exp $ */
/*
* Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved.
*
@@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* from: @(#)ffs_softdep.c 9.59 (McKusick) 6/21/00
- * $FreeBSD: src/sys/ufs/ffs/ffs_softdep.c,v 1.84 2001/02/04 16:08:18 phk Exp $
+ * $FreeBSD: src/sys/ufs/ffs/ffs_softdep.c,v 1.86 2001/02/04 16:08:18 phk Exp $
*/
/*
@@ -225,12 +225,17 @@ acquire_lock(lk, line)
struct lockit *lk;
int line;
{
+ pid_t holder;
+ int original_line;
if (lk->lkt_held != -1) {
- if (lk->lkt_held == CURPROC->p_pid)
- panic("softdep_lock: locking against myself, acquired at line %d", lk->lkt_line);
+ holder = lk->lkt_held;
+ original_line = lk->lkt_line;
+ FREE_LOCK(lk);
+ if (holder == CURPROC->p_pid)
+ panic("softdep_lock: locking against myself, acquired at line %d", original_line);
else
- panic("softdep_lock: lock held by %d, acquired at line %d", lk->lkt_held, line);
+ panic("softdep_lock: lock held by %d, acquired at line %d", holder, original_line);
}
lk->lkt_spl = splbio();
lk->lkt_held = CURPROC->p_pid;
@@ -255,12 +260,17 @@ acquire_lock_interlocked(lk, line)
struct lockit *lk;
int line;
{
+ pid_t holder;
+ int original_line;
if (lk->lkt_held != -1) {
- if (lk->lkt_held == CURPROC->p_pid)
- panic("softdep_lock: locking against myself, acquired at line %d", lk->lkt_line);
+ holder = lk->lkt_held;
+ original_line = lk->lkt_line;
+ FREE_LOCK(lk);
+ if (holder == CURPROC->p_pid)
+ panic("softdep_lock: locking against myself, acquired at line %d", original_line);
else
- panic("softdep_lock: lock held by %d, acquired at line %d", lk->lkt_held, lk->lkt_line);
+ panic("softdep_lock: lock held by %d, acquired at line %d", holder, original_line);
}
lk->lkt_held = CURPROC->p_pid;
lk->lkt_line = line;
@@ -334,8 +344,11 @@ sema_release(semap)
struct sema *semap;
{
- if (semap->value <= 0 || semap->holder != CURPROC->p_pid)
+ if (semap->value <= 0 || semap->holder != CURPROC->p_pid) {
+ if (lk.lkt_held != -1)
+ FREE_LOCK(&lk);
panic("sema_release: not held");
+ }
if (--semap->value > 0) {
semap->value = 0;
wakeup(semap);
@@ -375,8 +388,10 @@ worklist_insert(head, item)
if (lk.lkt_held == -1)
panic("worklist_insert: lock not held");
- if (item->wk_state & ONWORKLIST)
+ if (item->wk_state & ONWORKLIST) {
+ FREE_LOCK(&lk);
panic("worklist_insert: already on list");
+ }
item->wk_state |= ONWORKLIST;
LIST_INSERT_HEAD(head, item, wk_list);
}
@@ -388,8 +403,10 @@ worklist_remove(item)
if (lk.lkt_held == -1)
panic("worklist_remove: lock not held");
- if ((item->wk_state & ONWORKLIST) == 0)
+ if ((item->wk_state & ONWORKLIST) == 0) {
+ FREE_LOCK(&lk);
panic("worklist_remove: not on list");
+ }
item->wk_state &= ~ONWORKLIST;
LIST_REMOVE(item, wk_list);
}
@@ -400,10 +417,16 @@ workitem_free(item, type)
int type;
{
- if (item->wk_state & ONWORKLIST)
+ if (item->wk_state & ONWORKLIST) {
+ if (lk.lkt_held != -1)
+ FREE_LOCK(&lk);
panic("workitem_free: still on list");
- if (item->wk_type != type)
+ }
+ if (item->wk_type != type) {
+ if (lk.lkt_held != -1)
+ FREE_LOCK(&lk);
panic("workitem_free: type mismatch");
+ }
FREE(item, DtoM(type));
}
#endif /* DEBUG */
@@ -458,7 +481,7 @@ struct ctldebug debug31 = { "dir_entry", &stat_dir_entry };
void wakeup_one __P((void *));
void
-wakeup_one(c)
+wakeup_one(c)
void *c;
{
wakeup(c);
@@ -477,8 +500,11 @@ add_to_worklist(wk)
{
static struct worklist *worklist_tail;
- if (wk->wk_state & ONWORKLIST)
+ if (wk->wk_state & ONWORKLIST) {
+ if (lk.lkt_held != -1)
+ FREE_LOCK(&lk);
panic("add_to_worklist: already on list");
+ }
wk->wk_state |= ONWORKLIST;
if (LIST_FIRST(&softdep_workitem_pending) == NULL)
LIST_INSERT_HEAD(&softdep_workitem_pending, wk, wk_list);
@@ -581,7 +607,7 @@ softdep_process_worklist(matchmnt)
struct timeval diff;
timersub(&time, &starttime, &diff);
- if (diff.tv_sec > 0 && matchmnt == NULL) {
+ if (diff.tv_sec != 0 && matchmnt == NULL) {
matchcnt = -1;
break;
}
@@ -625,8 +651,10 @@ process_worklist_item(matchmnt, flags)
if (vp == NULL || !VOP_ISLOCKED(vp))
break;
}
- if (wk == 0)
+ if (wk == 0) {
+ FREE_LOCK(&lk);
return (0);
+ }
WORKLIST_REMOVE(wk);
num_on_worklist -= 1;
FREE_LOCK(&lk);
@@ -1036,8 +1064,12 @@ softdep_initialize()
LIST_INIT(&mkdirlisthd);
LIST_INIT(&softdep_workitem_pending);
+#ifdef KMEMSTATS
max_softdeps = min (desiredvnodes * 8,
kmemstats[M_INODEDEP].ks_limit / (2 * sizeof(struct inodedep)));
+#else
+ max_softdeps = desiredvnodes * 4;
+#endif
pagedep_hashtbl = hashinit(desiredvnodes / 5, M_PAGEDEP, M_WAITOK,
&pagedep_hash);
sema_init(&pagedep_in_progress, "pagedep", PRIBIO, 0);
@@ -1148,8 +1180,10 @@ softdep_setup_inomapdep(bp, ip, newinum)
*/
ACQUIRE_LOCK(&lk);
if (inodedep_lookup(ip->i_fs, newinum, DEPALLOC | NODELAY, &inodedep)
- != 0)
+ != 0) {
+ FREE_LOCK(&lk);
panic("softdep_setup_inomapdep: found inode");
+ }
inodedep->id_buf = bp;
inodedep->id_state &= ~DEPCOMPLETE;
bmsafemap = bmsafemap_lookup(bp);
@@ -1301,8 +1335,10 @@ softdep_setup_allocdirect(ip, lbn, newblkno, oldblkno, newsize, oldsize, bp)
WORKLIST_INSERT(&bp->b_dep, &adp->ad_list);
if (lbn >= NDADDR) {
/* allocating an indirect block */
- if (oldblkno != 0)
+ if (oldblkno != 0) {
+ FREE_LOCK(&lk);
panic("softdep_setup_allocdirect: non-zero indir");
+ }
} else {
/*
* Allocating a direct block.
@@ -1341,8 +1377,10 @@ softdep_setup_allocdirect(ip, lbn, newblkno, oldblkno, newsize, oldsize, bp)
if (oldadp->ad_lbn >= lbn)
break;
}
- if (oldadp == NULL)
+ if (oldadp == NULL) {
+ FREE_LOCK(&lk);
panic("softdep_setup_allocdirect: lost entry");
+ }
/* insert in middle of list */
TAILQ_INSERT_BEFORE(oldadp, adp, ad_next);
if (oldadp->ad_lbn == lbn)
@@ -1368,10 +1406,12 @@ allocdirect_merge(adphead, newadp, oldadp)
#endif
if (newadp->ad_oldblkno != oldadp->ad_newblkno ||
newadp->ad_oldsize != oldadp->ad_newsize ||
- newadp->ad_lbn >= NDADDR)
+ newadp->ad_lbn >= NDADDR) {
+ FREE_LOCK(&lk);
panic("allocdirect_check: old %d != new %d || lbn %ld >= %d",
newadp->ad_oldblkno, oldadp->ad_newblkno, newadp->ad_lbn,
NDADDR);
+ }
newadp->ad_oldblkno = oldadp->ad_oldblkno;
newadp->ad_oldsize = oldadp->ad_oldsize;
/*
@@ -1614,8 +1654,10 @@ setup_allocindir_phase2(bp, ip, aip)
break;
freefrag = NULL;
if (oldaip != NULL) {
- if (oldaip->ai_newblkno != aip->ai_oldblkno)
+ if (oldaip->ai_newblkno != aip->ai_oldblkno) {
+ FREE_LOCK(&lk);
panic("setup_allocindir_phase2: blkno");
+ }
aip->ai_oldblkno = oldaip->ai_oldblkno;
freefrag = aip->ai_freefrag;
aip->ai_freefrag = oldaip->ai_freefrag;
@@ -1737,8 +1779,10 @@ softdep_setup_freeblocks(ip, length)
*/
ACQUIRE_LOCK(&lk);
(void) inodedep_lookup(fs, ip->i_number, DEPALLOC, &inodedep);
- if ((inodedep->id_state & IOSTARTED) != 0)
+ if ((inodedep->id_state & IOSTARTED) != 0) {
+ FREE_LOCK(&lk);
panic("softdep_setup_freeblocks: inode busy");
+ }
/*
* Add the freeblks structure to the list of operations that
* must await the zero'ed inode being written to disk. If we
@@ -1832,14 +1876,18 @@ deallocate_dependencies(bp, inodedep)
* copy, allowing the safe copy to be freed and holding
* on to the real copy for later use in indir_trunc.
*/
- if (indirdep->ir_state & GOINGAWAY)
+ if (indirdep->ir_state & GOINGAWAY) {
+ FREE_LOCK(&lk);
panic("deallocate_dependencies: already gone");
+ }
indirdep->ir_state |= GOINGAWAY;
while ((aip = LIST_FIRST(&indirdep->ir_deplisthd)) != 0)
free_allocindir(aip, inodedep);
if (bp->b_lblkno >= 0 ||
- bp->b_blkno != indirdep->ir_savebp->b_lblkno)
+ bp->b_blkno != indirdep->ir_savebp->b_lblkno) {
+ FREE_LOCK(&lk);
panic("deallocate_dependencies: not indir");
+ }
bcopy(bp->b_data, indirdep->ir_savebp->b_data,
bp->b_bcount);
WORKLIST_REMOVE(wk);
@@ -1886,11 +1934,13 @@ deallocate_dependencies(bp, inodedep)
case D_ALLOCDIRECT:
case D_INODEDEP:
+ FREE_LOCK(&lk);
panic("deallocate_dependencies: Unexpected type %s",
TYPENAME(wk->wk_type));
/* NOTREACHED */
default:
+ FREE_LOCK(&lk);
panic("deallocate_dependencies: Unknown type %s",
TYPENAME(wk->wk_type));
/* NOTREACHED */
@@ -2008,8 +2058,10 @@ check_inode_unwritten(inodedep)
FREE(inodedep->id_savedino, M_INODEDEP);
inodedep->id_savedino = NULL;
}
- if (free_inodedep(inodedep) == 0)
+ if (free_inodedep(inodedep) == 0) {
+ FREE_LOCK(&lk);
panic("check_inode_unwritten: busy inode");
+ }
return (1);
}
@@ -2147,12 +2199,16 @@ indir_trunc(ip, dbn, level, lbn, countp)
(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)
+ (indirdep->ir_state & GOINGAWAY) == 0) {
+ FREE_LOCK(&lk);
panic("indir_trunc: lost indirdep");
+ }
WORKLIST_REMOVE(wk);
WORKITEM_FREE(indirdep, D_INDIRDEP);
- if (LIST_FIRST(&bp->b_dep) != NULL)
+ if (LIST_FIRST(&bp->b_dep) != NULL) {
+ FREE_LOCK(&lk);
panic("indir_trunc: dangling dep");
+ }
FREE_LOCK(&lk);
} else {
FREE_LOCK(&lk);
@@ -2420,8 +2476,10 @@ free_diradd(dap)
LIST_REMOVE(mkdir, md_mkdirs);
WORKITEM_FREE(mkdir, D_MKDIR);
}
- if ((dap->da_state & (MKDIR_PARENT | MKDIR_BODY)) != 0)
+ if ((dap->da_state & (MKDIR_PARENT | MKDIR_BODY)) != 0) {
+ FREE_LOCK(&lk);
panic("free_diradd: unfound ref");
+ }
}
WORKITEM_FREE(dap, D_DIRADD);
}
@@ -2550,11 +2608,15 @@ newdirrem(bp, dp, ip, isrmdir, prevdirremp)
/*
* Must be ATTACHED at this point.
*/
- if ((dap->da_state & ATTACHED) == 0)
+ if ((dap->da_state & ATTACHED) == 0) {
+ FREE_LOCK(&lk);
panic("newdirrem: not ATTACHED");
- if (dap->da_newinum != ip->i_number)
+ }
+ if (dap->da_newinum != ip->i_number) {
+ FREE_LOCK(&lk);
panic("newdirrem: inum %d should be %d",
ip->i_number, dap->da_newinum);
+ }
/*
* If we are deleting a changed name that never made it to disk,
* then return the dirrem describing the previous inode (which
@@ -2713,8 +2775,10 @@ softdep_change_linkcnt(ip)
ACQUIRE_LOCK(&lk);
(void) inodedep_lookup(ip->i_fs, ip->i_number, DEPALLOC, &inodedep);
- if (ip->i_ffs_nlink < ip->i_effnlink)
+ if (ip->i_ffs_nlink < ip->i_effnlink) {
+ FREE_LOCK(&lk);
panic("softdep_change_linkcnt: bad delta");
+ }
inodedep->id_nlinkdelta = ip->i_ffs_nlink - ip->i_effnlink;
FREE_LOCK(&lk);
}
@@ -2740,16 +2804,21 @@ handle_workitem_remove(dirrem)
}
ip = VTOI(vp);
ACQUIRE_LOCK(&lk);
- if ((inodedep_lookup(ip->i_fs, dirrem->dm_oldinum, 0, &inodedep)) == 0)
+ if ((inodedep_lookup(ip->i_fs, dirrem->dm_oldinum, 0, &inodedep))
+ == 0) {
+ FREE_LOCK(&lk);
panic("handle_workitem_remove: lost inodedep");
+ }
/*
* Normal file deletion.
*/
if ((dirrem->dm_state & RMDIR) == 0) {
ip->i_ffs_nlink--;
ip->i_flag |= IN_CHANGE;
- if (ip->i_ffs_nlink < ip->i_effnlink)
+ if (ip->i_ffs_nlink < ip->i_effnlink) {
+ FREE_LOCK(&lk);
panic("handle_workitem_remove: bad file delta");
+ }
inodedep->id_nlinkdelta = ip->i_ffs_nlink - ip->i_effnlink;
FREE_LOCK(&lk);
vput(vp);
@@ -2832,9 +2901,10 @@ handle_workitem_freefile(freefile)
fs = VFSTOUFS(freefile->fx_mnt)->um_fs;
#ifdef DEBUG
ACQUIRE_LOCK(&lk);
- if (inodedep_lookup(fs, freefile->fx_oldinum, 0, &idp))
- panic("handle_workitem_freefile: inodedep survived");
+ error = inodedep_lookup(fs, freefile->fx_oldinum, 0, &idp);
FREE_LOCK(&lk);
+ if (error)
+ panic("handle_workitem_freefile: inodedep survived");
#endif
tip.i_devvp = freefile->fx_devvp;
tip.i_dev = freefile->fx_devvp->v_rdev;
@@ -2980,10 +3050,12 @@ initiate_write_filepage(pagedep, bp)
LIST_FOREACH(dap, &pagedep->pd_diraddhd[i], da_pdlist) {
ep = (struct direct *)
((char *)bp->b_data + dap->da_offset);
- if (ep->d_ino != dap->da_newinum)
+ if (ep->d_ino != dap->da_newinum) {
+ FREE_LOCK(&lk);
panic("%s: dir inum %d != new %d",
"initiate_write_filepage",
ep->d_ino, dap->da_newinum);
+ }
if (dap->da_state & DIRCHG)
ep->d_ino = dap->da_previous->dm_oldinum;
else
@@ -3044,23 +3116,31 @@ initiate_write_inodeblock(inodedep, bp)
for (deplist = 0, adp = TAILQ_FIRST(&inodedep->id_inoupdt); adp;
adp = TAILQ_NEXT(adp, ad_next)) {
#ifdef DIAGNOSTIC
- if (deplist != 0 && prevlbn >= adp->ad_lbn)
+ if (deplist != 0 && prevlbn >= adp->ad_lbn) {
+ FREE_LOCK(&lk);
panic("softdep_write_inodeblock: lbn order");
+ }
prevlbn = adp->ad_lbn;
if (adp->ad_lbn < NDADDR &&
- dp->di_db[adp->ad_lbn] != adp->ad_newblkno)
+ dp->di_db[adp->ad_lbn] != adp->ad_newblkno) {
+ FREE_LOCK(&lk);
panic("%s: direct pointer #%ld mismatch %d != %d",
"softdep_write_inodeblock", adp->ad_lbn,
dp->di_db[adp->ad_lbn], adp->ad_newblkno);
+ }
if (adp->ad_lbn >= NDADDR &&
- dp->di_ib[adp->ad_lbn - NDADDR] != adp->ad_newblkno)
+ dp->di_ib[adp->ad_lbn - NDADDR] != adp->ad_newblkno) {
+ FREE_LOCK(&lk);
panic("%s: indirect pointer #%ld mismatch %d != %d",
"softdep_write_inodeblock", adp->ad_lbn - NDADDR,
dp->di_ib[adp->ad_lbn - NDADDR], adp->ad_newblkno);
+ }
deplist |= 1 << adp->ad_lbn;
- if ((adp->ad_state & ATTACHED) == 0)
+ if ((adp->ad_state & ATTACHED) == 0) {
+ FREE_LOCK(&lk);
panic("softdep_write_inodeblock: Unknown state 0x%x",
adp->ad_state);
+ }
#endif /* DIAGNOSTIC */
adp->ad_state &= ~ATTACHED;
adp->ad_state |= UNDONE;
@@ -3082,16 +3162,20 @@ initiate_write_inodeblock(inodedep, bp)
dp->di_size = fs->fs_bsize * adp->ad_lbn + adp->ad_oldsize;
for (i = adp->ad_lbn + 1; i < NDADDR; i++) {
#ifdef DIAGNOSTIC
- if (dp->di_db[i] != 0 && (deplist & (1 << i)) == 0)
+ if (dp->di_db[i] != 0 && (deplist & (1 << i)) == 0) {
+ FREE_LOCK(&lk);
panic("softdep_write_inodeblock: lost dep1");
+ }
#endif /* DIAGNOSTIC */
dp->di_db[i] = 0;
}
for (i = 0; i < NIADDR; i++) {
#ifdef DIAGNOSTIC
if (dp->di_ib[i] != 0 &&
- (deplist & ((1 << NDADDR) << i)) == 0)
+ (deplist & ((1 << NDADDR) << i)) == 0) {
+ FREE_LOCK(&lk);
panic("softdep_write_inodeblock: lost dep2");
+ }
#endif /* DIAGNOSTIC */
dp->di_ib[i] = 0;
}
@@ -3271,6 +3355,7 @@ handle_allocdirect_partdone(adp)
return;
if (adp->ad_buf != NULL)
panic("handle_allocdirect_partdone: dangling dep");
+
/*
* The on-disk inode cannot claim to be any larger than the last
* fragment that has been written. Otherwise, the on-disk inode
@@ -3709,13 +3794,15 @@ softdep_update_inodeblock(ip, bp, waitfor)
*/
ACQUIRE_LOCK(&lk);
if (inodedep_lookup(ip->i_fs, ip->i_number, 0, &inodedep) == 0) {
+ FREE_LOCK(&lk);
if (ip->i_effnlink != ip->i_ffs_nlink)
panic("softdep_update_inodeblock: bad link count");
- FREE_LOCK(&lk);
return;
}
- if (inodedep->id_nlinkdelta != ip->i_ffs_nlink - ip->i_effnlink)
+ if (inodedep->id_nlinkdelta != ip->i_ffs_nlink - ip->i_effnlink) {
+ FREE_LOCK(&lk);
panic("softdep_update_inodeblock: bad delta");
+ }
/*
* Changes have been initiated. Anything depending on these
* changes cannot occur until this inode has been written.
@@ -3827,14 +3914,18 @@ softdep_fsync(vp)
if (LIST_FIRST(&inodedep->id_inowait) != NULL ||
LIST_FIRST(&inodedep->id_bufwait) != NULL ||
TAILQ_FIRST(&inodedep->id_inoupdt) != NULL ||
- TAILQ_FIRST(&inodedep->id_newinoupdt) != NULL)
+ TAILQ_FIRST(&inodedep->id_newinoupdt) != NULL) {
+ FREE_LOCK(&lk);
panic("softdep_fsync: pending ops");
+ }
for (error = 0, flushparent = 0; ; ) {
if ((wk = LIST_FIRST(&inodedep->id_pendinghd)) == NULL)
break;
- if (wk->wk_type != D_DIRADD)
+ if (wk->wk_type != D_DIRADD) {
+ FREE_LOCK(&lk);
panic("softdep_fsync: Unexpected type %s",
TYPENAME(wk->wk_type));
+ }
dap = WK_DIRADD(wk);
/*
* Flush our parent if this directory entry
@@ -3847,8 +3938,10 @@ softdep_fsync(vp)
mnt = pagedep->pd_mnt;
parentino = pagedep->pd_ino;
lbn = pagedep->pd_lbn;
- if ((dap->da_state & (MKDIR_BODY | COMPLETE)) != COMPLETE)
+ if ((dap->da_state & (MKDIR_BODY | COMPLETE)) != COMPLETE) {
+ FREE_LOCK(&lk);
panic("softdep_fsync: dirty");
+ }
flushparent = dap->da_state & MKDIR_PARENT;
/*
* If we are being fsync'ed as part of vgone'ing this vnode,
@@ -3922,8 +4015,10 @@ softdep_fsync_mountdev(vp)
continue;
bp->b_flags |= B_BUSY;
- if ((bp->b_flags & B_DELWRI) == 0)
+ if ((bp->b_flags & B_DELWRI) == 0) {
+ FREE_LOCK(&lk);
panic("softdep_fsync_mountdev: not dirty");
+ }
/*
* We are only interested in bitmaps with outstanding
* dependencies.
@@ -4148,6 +4243,7 @@ loop:
break;
default:
+ FREE_LOCK(&lk);
panic("softdep_sync_metadata: Unknown type %s",
TYPENAME(wk->wk_type));
/* NOTREACHED */
@@ -4332,8 +4428,10 @@ flush_pagedep_deps(pvp, mp, diraddhdp)
*/
if (dap != LIST_FIRST(diraddhdp))
continue;
- if (dap->da_state & MKDIR_PARENT)
+ if (dap->da_state & MKDIR_PARENT) {
+ FREE_LOCK(&lk);
panic("flush_pagedep_deps: MKDIR_PARENT");
+ }
}
/*
* A newly allocated directory must have its "." and
@@ -4348,6 +4446,7 @@ flush_pagedep_deps(pvp, mp, diraddhdp)
* happen at most once.
*/
inum = dap->da_newinum;
+ /* XXXCPS - figure out locking here */
if (dap->da_state & MKDIR_BODY) {
FREE_LOCK(&lk);
if ((error = VFS_VGET(mp, inum, &vp)) != 0)
@@ -4365,8 +4464,10 @@ flush_pagedep_deps(pvp, mp, diraddhdp)
*/
if (dap != LIST_FIRST(diraddhdp))
continue;
- if (dap->da_state & MKDIR_BODY)
+ if (dap->da_state & MKDIR_BODY) {
+ FREE_LOCK(&lk);
panic("flush_pagedep_deps: MKDIR_BODY");
+ }
}
/*
* Flush the inode on which the directory entry depends.
@@ -4378,8 +4479,10 @@ flush_pagedep_deps(pvp, mp, diraddhdp)
* locate that buffer, ensure that there will be no rollback
* caused by a bitmap dependency, then write the inode buffer.
*/
- if (inodedep_lookup(ump->um_fs, inum, 0, &inodedep) == 0)
+ if (inodedep_lookup(ump->um_fs, inum, 0, &inodedep) == 0) {
+ FREE_LOCK(&lk);
panic("flush_pagedep_deps: lost inode");
+ }
/*
* If the inode still has bitmap dependencies,
* push them to disk.
@@ -4410,8 +4513,10 @@ flush_pagedep_deps(pvp, mp, diraddhdp)
* If we have failed to get rid of all the dependencies
* then something is seriously wrong.
*/
- if (dap == LIST_FIRST(diraddhdp))
+ if (dap == LIST_FIRST(diraddhdp)) {
+ FREE_LOCK(&lk);
panic("flush_pagedep_deps: flush failed");
+ }
}
if (error)
ACQUIRE_LOCK(&lk);
@@ -4503,6 +4608,8 @@ request_cleanup(resource, islocked)
break;
default:
+ if (islocked)
+ FREE_LOCK(&lk);
panic("request_cleanup: unknown type");
}
/*
@@ -4624,6 +4731,10 @@ clear_inodedeps(p)
if ((inodedep = LIST_FIRST(inodedephd)) != NULL)
break;
}
+ if (inodedep == NULL) {
+ FREE_LOCK(&lk);
+ return;
+ }
/*
* Ugly code to find mount point given pointer to superblock.
*/
@@ -4746,6 +4857,7 @@ softdep_count_dependencies(bp, wantcount)
continue;
default:
+ FREE_LOCK(&lk);
panic("softdep_check_for_rollback: Unexpected type %s",
TYPENAME(wk->wk_type));
/* NOTREACHED */