pseudofs: use vget_prep + vget_finish instead of vget + the interlock

This commit is contained in:
Mateusz Guzik 2021-05-19 14:20:23 +00:00
parent 086feed850
commit 43999a5cba

View File

@ -120,6 +120,7 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp,
struct pfs_vncache_head *hash; struct pfs_vncache_head *hash;
struct pfs_vdata *pvd, *pvd2; struct pfs_vdata *pvd, *pvd2;
struct vnode *vp; struct vnode *vp;
enum vgetstate vs;
int error; int error;
/* /*
@ -134,9 +135,9 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp,
if (pvd->pvd_pn == pn && pvd->pvd_pid == pid && if (pvd->pvd_pn == pn && pvd->pvd_pid == pid &&
pvd->pvd_vnode->v_mount == mp) { pvd->pvd_vnode->v_mount == mp) {
vp = pvd->pvd_vnode; vp = pvd->pvd_vnode;
VI_LOCK(vp); vs = vget_prep(vp);
mtx_unlock(&pfs_vncache_mutex); mtx_unlock(&pfs_vncache_mutex);
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK) == 0) { if (vget_finish(vp, LK_EXCLUSIVE, vs) == 0) {
++pfs_vncache_hits; ++pfs_vncache_hits;
*vpp = vp; *vpp = vp;
/* /*