Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jul 2016 14:19:09 +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: r302567 - in head/sys: kern vm
Message-ID:  <201607111419.u6BEJ9sU022415@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Jul 11 14:19:09 2016
New Revision: 302567
URL: https://svnweb.freebsd.org/changeset/base/302567

Log:
  In vgonel(), postpone setting BO_DEAD until VOP_RECLAIM() is called,
  if vnode is VMIO.  For VMIO vnodes, set BO_DEAD in vm_object_terminate().
  
  The vnode_destroy_object(), when calling into vm_object_terminate(),
  must be able to flush buffers.  BO_DEAD purpose is to quickly destroy
  buffers on write when the underlying vnode is not operable any more
  (one example is the devfs node after geom is gone).  Setting BO_DEAD
  for reclaiming vnode before object is terminated is premature, and
  results in unability to flush buffers with live SU dependencies from
  vinvalbuf() in vm_object_terminate().
  
  Reported by:	David Cross <dcrosstech@gmail.com>
  Tested by:	pho
  Sponsored by:	The FreeBSD Foundation
  MFC after:	2 weeks

Modified:
  head/sys/kern/vfs_subr.c
  head/sys/vm/vm_object.c

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Mon Jul 11 14:07:24 2016	(r302566)
+++ head/sys/kern/vfs_subr.c	Mon Jul 11 14:19:09 2016	(r302567)
@@ -3232,7 +3232,13 @@ vgonel(struct vnode *vp)
 	    TAILQ_EMPTY(&vp->v_bufobj.bo_clean.bv_hd) &&
 	    vp->v_bufobj.bo_clean.bv_cnt == 0,
 	    ("vp %p bufobj not invalidated", vp));
-	vp->v_bufobj.bo_flag |= BO_DEAD;
+
+	/*
+	 * For VMIO bufobj, BO_DEAD is set in vm_object_terminate()
+	 * after the object' page queue is flushed.
+	 */
+	if (vp->v_bufobj.bo_object == NULL)
+		vp->v_bufobj.bo_flag |= BO_DEAD;
 	BO_UNLOCK(&vp->v_bufobj);
 
 	/*

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c	Mon Jul 11 14:07:24 2016	(r302566)
+++ head/sys/vm/vm_object.c	Mon Jul 11 14:19:09 2016	(r302567)
@@ -741,6 +741,10 @@ vm_object_terminate(vm_object_t object)
 
 		vinvalbuf(vp, V_SAVE, 0, 0);
 
+		BO_LOCK(&vp->v_bufobj);
+		vp->v_bufobj.bo_flag |= BO_DEAD;
+		BO_UNLOCK(&vp->v_bufobj);
+
 		VM_OBJECT_WLOCK(object);
 	}
 



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