From 6acdfd69be1438d21d67eafea38ef11c24de1570 Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Sun, 5 Oct 2003 06:43:03 +0000 Subject: [PATCH] - File systems that wish to inspect the vnode contents or their private v_data field before calling vget/vn_lock must check VI_XLOCK manually to be sure that v_data is still valid. Implement this check in two places here. --- sys/gnu/ext2fs/ext2_vfsops.c | 8 ++++++++ sys/gnu/fs/ext2fs/ext2_vfsops.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c index b8b15be131f..c9544c16398 100644 --- a/sys/gnu/ext2fs/ext2_vfsops.c +++ b/sys/gnu/ext2fs/ext2_vfsops.c @@ -577,6 +577,10 @@ loop: } nvp = TAILQ_NEXT(vp, v_nmntvnodes); VI_LOCK(vp); + if (vp->v_iflag & VI_XLOCK) { + VI_UNLOCK(vp); + continue; + } mtx_unlock(&mntvnode_mtx); /* * Step 4: invalidate all inactive vnodes. @@ -906,6 +910,10 @@ loop: goto loop; nvp = TAILQ_NEXT(vp, v_nmntvnodes); VI_LOCK(vp); + if (vp->v_iflag & VI_XLOCK) { + VI_UNLOCK(vp); + continue; + } mtx_unlock(&mntvnode_mtx); ip = VTOI(vp); if (vp->v_type == VNON || diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index b8b15be131f..c9544c16398 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -577,6 +577,10 @@ loop: } nvp = TAILQ_NEXT(vp, v_nmntvnodes); VI_LOCK(vp); + if (vp->v_iflag & VI_XLOCK) { + VI_UNLOCK(vp); + continue; + } mtx_unlock(&mntvnode_mtx); /* * Step 4: invalidate all inactive vnodes. @@ -906,6 +910,10 @@ loop: goto loop; nvp = TAILQ_NEXT(vp, v_nmntvnodes); VI_LOCK(vp); + if (vp->v_iflag & VI_XLOCK) { + VI_UNLOCK(vp); + continue; + } mtx_unlock(&mntvnode_mtx); ip = VTOI(vp); if (vp->v_type == VNON ||