Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Oct 2015 16:34:54 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288451 - head/sys/kern
Message-ID:  <201510011634.t91GYsml085136@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 		/*



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