svn commit: r195485 - in stable/7/sys: . contrib/pf kern
Konstantin Belousov
kib at FreeBSD.org
Thu Jul 9 09:12:22 UTC 2009
Author: kib
Date: Thu Jul 9 09:12:16 2009
New Revision: 195485
URL: http://svn.freebsd.org/changeset/base/195485
Log:
MFC r194993:
In lf_iteratelocks_vnode, increment state->ls_threads around iterating
of the vnode advisory lock list. This prevents deallocation of state
while inside the loop.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/kern/kern_lockf.c
Modified: stable/7/sys/kern/kern_lockf.c
==============================================================================
--- stable/7/sys/kern/kern_lockf.c Thu Jul 9 01:58:59 2009 (r195484)
+++ stable/7/sys/kern/kern_lockf.c Thu Jul 9 09:12:16 2009 (r195485)
@@ -1937,9 +1937,14 @@ lf_iteratelocks_vnode(struct vnode *vp,
* make sure it doesn't go away before we are finished.
*/
STAILQ_INIT(&locks);
+ VI_LOCK(vp);
ls = vp->v_lockf;
- if (!ls)
+ if (!ls) {
+ VI_UNLOCK(vp);
return (0);
+ }
+ ls->ls_threads++;
+ VI_UNLOCK(vp);
sx_xlock(&ls->ls_lock);
LIST_FOREACH(lf, &ls->ls_active, lf_link) {
@@ -1960,6 +1965,10 @@ lf_iteratelocks_vnode(struct vnode *vp,
STAILQ_INSERT_TAIL(&locks, ldesc, link);
}
sx_xunlock(&ls->ls_lock);
+ VI_LOCK(vp);
+ ls->ls_threads--;
+ wakeup(ls);
+ VI_UNLOCK(vp);
/*
* Call the iterator function for each lock in turn. If the
More information about the svn-src-stable-7
mailing list