svn commit: r351882 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Thu Sep 5 18:19:52 UTC 2019


Author: mjg
Date: Thu Sep  5 18:19:51 2019
New Revision: 351882
URL: https://svnweb.freebsd.org/changeset/base/351882

Log:
  vfs: temporarily revert r351825
  
  There are 2 problems:
  - it introduces a funny bug where it can end up trylocking the same vnode [1]
  - it exposes a pre-existing softdep deadlock [2]
  
  Both are easier to run into that the bug which got fixed, so revert until
  a complete solution is worked out.
  
  Reported by:	cy [1], pho [2]
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Thu Sep  5 18:07:40 2019	(r351881)
+++ head/sys/kern/vfs_subr.c	Thu Sep  5 18:19:51 2019	(r351882)
@@ -1102,6 +1102,7 @@ vnlru_free_locked(int count, struct vfsops *mnt_op)
 		    ("Removing vnode not on freelist"));
 		KASSERT((vp->v_iflag & VI_ACTIVE) == 0,
 		    ("Mangling active vnode"));
+		TAILQ_REMOVE(&vnode_free_list, vp, v_actfreelist);
 
 		/*
 		 * Don't recycle if our vnode is from different type
@@ -1113,6 +1114,7 @@ vnlru_free_locked(int count, struct vfsops *mnt_op)
 		 */
 		if ((mnt_op != NULL && (mp = vp->v_mount) != NULL &&
 		    mp->mnt_op != mnt_op) || !VI_TRYLOCK(vp)) {
+			TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_actfreelist);
 			continue;
 		}
 		VNASSERT((vp->v_iflag & VI_FREE) != 0 && vp->v_holdcnt == 0,
@@ -1127,8 +1129,11 @@ vnlru_free_locked(int count, struct vfsops *mnt_op)
 		 * activating.
 		 */
 		freevnodes--;
+		vp->v_iflag &= ~VI_FREE;
+		VNODE_REFCOUNT_FENCE_REL();
+		refcount_acquire(&vp->v_holdcnt);
+
 		mtx_unlock(&vnode_free_list_mtx);
-		vholdl(vp);
 		VI_UNLOCK(vp);
 		vtryrecycle(vp);
 		/*


More information about the svn-src-head mailing list