svn commit: r288451 - head/sys/kern

Mark Johnston markj at FreeBSD.org
Thu Oct 1 16:34:54 UTC 2015


Author: markj
Date: Thu Oct  1 16:34:53 2015
New Revision: 288451
URL: https://svnweb.freebsd.org/changeset/base/288451

Log:
  Ensure that vop_stdadvise() does not call getblk() on vnodes that have an
  empty bufobj. Otherwise, vnodes belonging to filesystems that do not use the
  buffer cache may trigger assertion failures.
  
  Reported by:	Fabien Keil

Modified:
  head/sys/kern/vfs_default.c

Modified: head/sys/kern/vfs_default.c
==============================================================================
--- head/sys/kern/vfs_default.c	Thu Oct  1 16:30:20 2015	(r288450)
+++ head/sys/kern/vfs_default.c	Thu Oct  1 16:34:53 2015	(r288451)
@@ -1077,16 +1077,15 @@ vop_stdadvise(struct vop_advise_args *ap
 		BO_RLOCK(&vp->v_bufobj);
 		bsize = vp->v_bufobj.bo_bsize;
 		startn = ap->a_start / bsize;
-		if (ap->a_end == OFF_MAX) {
-			endn = -1;
-			bl = &vp->v_bufobj.bo_clean.bv_hd;
-			if (!TAILQ_EMPTY(bl))
-				endn = TAILQ_LAST(bl, buflists)->b_lblkno;
-			bl = &vp->v_bufobj.bo_dirty.bv_hd;
-			if (!TAILQ_EMPTY(bl) &&
-			    endn < TAILQ_LAST(bl, buflists)->b_lblkno)
-				endn = TAILQ_LAST(bl, buflists)->b_lblkno;
-		} else
+		endn = -1;
+		bl = &vp->v_bufobj.bo_clean.bv_hd;
+		if (!TAILQ_EMPTY(bl))
+			endn = TAILQ_LAST(bl, buflists)->b_lblkno;
+		bl = &vp->v_bufobj.bo_dirty.bv_hd;
+		if (!TAILQ_EMPTY(bl) &&
+		    endn < TAILQ_LAST(bl, buflists)->b_lblkno)
+			endn = TAILQ_LAST(bl, buflists)->b_lblkno;
+		if (ap->a_end != OFF_MAX && endn != -1)
 			endn = ap->a_end / bsize;
 		BO_RUNLOCK(&vp->v_bufobj);
 		/*


More information about the svn-src-head mailing list