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);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to