Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jun 2019 20:16:26 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r348698 - in head/sys/fs: nullfs tmpfs
Message-ID:  <201906052016.x55KGQpL040198@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Jun  5 20:16:25 2019
New Revision: 348698
URL: https://svnweb.freebsd.org/changeset/base/348698

Log:
  Manually clear text references on reclaim for nullfs and tmpfs.
  
  Both filesystems do no use vnode_pager_dealloc() which would handle
  this case otherwise.  Nullfs because vnode vm_object handle never
  points to nullfs vnode.  Tmpfs because its vm_object is never vnode
  object at all.
  
  Tested by:	pho
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/fs/nullfs/null_vnops.c
  head/sys/fs/tmpfs/tmpfs_subr.c

Modified: head/sys/fs/nullfs/null_vnops.c
==============================================================================
--- head/sys/fs/nullfs/null_vnops.c	Wed Jun  5 19:55:30 2019	(r348697)
+++ head/sys/fs/nullfs/null_vnops.c	Wed Jun  5 20:16:25 2019	(r348698)
@@ -810,6 +810,8 @@ null_reclaim(struct vop_reclaim_args *ap)
 	 */
 	if (vp->v_writecount > 0)
 		VOP_ADD_WRITECOUNT(lowervp, -vp->v_writecount);
+	else if (vp->v_writecount < 0)
+		vp->v_writecount = 0;
 
 	VI_UNLOCK(vp);
 

Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_subr.c	Wed Jun  5 19:55:30 2019	(r348697)
+++ head/sys/fs/tmpfs/tmpfs_subr.c	Wed Jun  5 20:16:25 2019	(r348698)
@@ -488,6 +488,8 @@ tmpfs_destroy_vobject(struct vnode *vp, vm_object_t ob
 	VI_LOCK(vp);
 	vm_object_clear_flag(obj, OBJ_TMPFS);
 	obj->un_pager.swp.swp_tmpfs = NULL;
+	if (vp->v_writecount < 0)
+		vp->v_writecount = 0;
 	VI_UNLOCK(vp);
 	VM_OBJECT_WUNLOCK(obj);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906052016.x55KGQpL040198>