Better checking for held inode locks in lfs_fastvget, for a number of error

conditions.  Also change the default setting of lfs_clean_vnhead to 0, which
seems to make the locking problems go away (although this is difficult to
test as I can't reliably reproduce them).
This commit is contained in:
perseant 1999-04-12 00:11:01 +00:00
parent 7221719dc7
commit e6b7726c9a
2 changed files with 16 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_segment.c,v 1.24 1999/04/12 00:04:21 perseant Exp $ */
/* $NetBSD: lfs_segment.c,v 1.25 1999/04/12 00:11:01 perseant Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -135,7 +135,7 @@ int lfs_writevnodes __P((struct lfs *fs, struct mount *mp,
int lfs_allclean_wakeup; /* Cleaner wakeup address. */
int lfs_writeindir = 1; /* whether to flush indir on non-ckp */
int lfs_clean_vnhead = 1; /* Allow freeing to head of vn list */
int lfs_clean_vnhead = 0; /* Allow freeing to head of vn list */
/* Statistics Counters */
int lfs_dostats = 1;
@ -1542,7 +1542,10 @@ lfs_vunref(vp)
simple_unlock(&vp->v_interlock);
return;
}
#ifdef DIAGNOSTIC
if(VOP_ISLOCKED(vp))
panic("lfs_vunref: vnode locked");
#endif
/*
* insert at tail of LRU list
*/
@ -1575,6 +1578,10 @@ lfs_vunref_head(vp)
simple_unlock(&vp->v_interlock);
return;
}
#ifdef DIAGNOSTIC
if(VOP_ISLOCKED(vp))
panic("lfs_vunref_head: vnode locked");
#endif
/*
* insert at head of LRU list
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_syscalls.c,v 1.27 1999/04/11 23:24:04 perseant Exp $ */
/* $NetBSD: lfs_syscalls.c,v 1.28 1999/04/12 00:11:01 perseant Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -960,6 +960,7 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp, need_unlock)
ufs_ihashrem(ip);
/* Unlock and discard unneeded inode. */
lockmgr(&ip->i_lock, LK_RELEASE, &vp->v_interlock);
lfs_vunref(vp);
*vpp = NULL;
return (error);
@ -979,6 +980,7 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp, need_unlock)
ufs_ihashrem(ip);
/* Unlock and discard unneeded inode. */
lockmgr(&ip->i_lock, LK_RELEASE, &vp->v_interlock);
lfs_vunref(vp);
brelse(bp);
*vpp = NULL;
@ -995,7 +997,9 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp, need_unlock)
*/
error = ufs_vinit(mp, lfs_specop_p, lfs_fifoop_p, &vp);
if (error) {
printf("ufs_vinit returned %d for ino %d\n", error, ino);
/* This CANNOT happen (see ufs_vinit) */
printf("lfs_fastvget: ufs_vinit returned %d for ino %d\n", error, ino);
lockmgr(&ip->i_lock, LK_RELEASE, &vp->v_interlock);
lfs_vunref(vp);
*vpp = NULL;
return (error);