1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-05 09:14:03 +00:00

To avoid lock order reversals in getnewvnode(), the call to uma_zfree()

must be delayed until the vnode interlock is released.

Reported by:	kris@
Approved by:	re (jhb)
This commit is contained in:
Alan Cox 2002-12-08 05:06:50 +00:00
parent e6f88402ff
commit 2e29a1f21f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107676

View File

@ -885,6 +885,7 @@ getnewvnode(tag, mp, vops, vpp)
int s;
struct thread *td = curthread; /* XXX */
struct vnode *vp = NULL;
struct vpollinfo *pollinfo = NULL;
struct mount *vnmp;
s = splbio();
@ -958,9 +959,12 @@ getnewvnode(tag, mp, vops, vpp)
panic("Non-zero write count");
}
#endif
if (vp->v_pollinfo) {
mtx_destroy(&vp->v_pollinfo->vpi_lock);
uma_zfree(vnodepoll_zone, vp->v_pollinfo);
if ((pollinfo = vp->v_pollinfo) != NULL) {
/*
* To avoid lock order reversals, the call to
* uma_zfree() must be delayed until the vnode
* interlock is released.
*/
vp->v_pollinfo = NULL;
}
#ifdef MAC
@ -1002,6 +1006,10 @@ getnewvnode(tag, mp, vops, vpp)
vp->v_data = 0;
vp->v_cachedid = -1;
VI_UNLOCK(vp);
if (pollinfo != NULL) {
mtx_destroy(&pollinfo->vpi_lock);
uma_zfree(vnodepoll_zone, pollinfo);
}
#ifdef MAC
mac_init_vnode(vp);
if (mp != NULL && (mp->mnt_flag & MNT_MULTILABEL) == 0)