summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2003-10-04 16:09:40 +0000
committerjeff <jeff@FreeBSD.org>2003-10-04 16:09:40 +0000
commit420cf70112c4eff7ddf30b717796a3e4852fc1c4 (patch)
tree742ef7d30a2fe9056002b12a0336a8c66e7214e4
parent8de9c70cc9e2ed979b9ed1117128d713bb13b1a9 (diff)
downloadFreeBSD-src-420cf70112c4eff7ddf30b717796a3e4852fc1c4.zip
FreeBSD-src-420cf70112c4eff7ddf30b717796a3e4852fc1c4.tar.gz
- Don't use vrecycle() call vgonel() directly after grabing the vnode
interlock. We do this so that we still hold the interlock when we lock the vnode later. This prevents races with the mnt vnode list.
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c10
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c10
2 files changed, 12 insertions, 8 deletions
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c
index a51d393..b8b15be 100644
--- a/sys/gnu/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/ext2fs/ext2_vfsops.c
@@ -576,16 +576,18 @@ loop:
goto loop;
}
nvp = TAILQ_NEXT(vp, v_nmntvnodes);
+ VI_LOCK(vp);
mtx_unlock(&mntvnode_mtx);
/*
* Step 4: invalidate all inactive vnodes.
*/
- if (vrecycle(vp, NULL, td))
- goto loop;
+ if (vp->v_usecount == 0) {
+ vgonel(vp, td);
+ goto loop;
+ }
/*
* Step 5: invalidate all cached file data.
*/
- mtx_lock(&vp->v_interlock);
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) {
goto loop;
}
@@ -903,8 +905,8 @@ loop:
if (vp->v_mount != mp)
goto loop;
nvp = TAILQ_NEXT(vp, v_nmntvnodes);
- mtx_unlock(&mntvnode_mtx);
VI_LOCK(vp);
+ mtx_unlock(&mntvnode_mtx);
ip = VTOI(vp);
if (vp->v_type == VNON ||
((ip->i_flag &
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index a51d393..b8b15be 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -576,16 +576,18 @@ loop:
goto loop;
}
nvp = TAILQ_NEXT(vp, v_nmntvnodes);
+ VI_LOCK(vp);
mtx_unlock(&mntvnode_mtx);
/*
* Step 4: invalidate all inactive vnodes.
*/
- if (vrecycle(vp, NULL, td))
- goto loop;
+ if (vp->v_usecount == 0) {
+ vgonel(vp, td);
+ goto loop;
+ }
/*
* Step 5: invalidate all cached file data.
*/
- mtx_lock(&vp->v_interlock);
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) {
goto loop;
}
@@ -903,8 +905,8 @@ loop:
if (vp->v_mount != mp)
goto loop;
nvp = TAILQ_NEXT(vp, v_nmntvnodes);
- mtx_unlock(&mntvnode_mtx);
VI_LOCK(vp);
+ mtx_unlock(&mntvnode_mtx);
ip = VTOI(vp);
if (vp->v_type == VNON ||
((ip->i_flag &
OpenPOWER on IntegriCloud