]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Ensure that vop_stdadvise() does not call getblk() on vnodes that have an
authormarkj <markj@FreeBSD.org>
Thu, 1 Oct 2015 16:34:53 +0000 (16:34 +0000)
committermarkj <markj@FreeBSD.org>
Thu, 1 Oct 2015 16:34:53 +0000 (16:34 +0000)
empty bufobj. Otherwise, vnodes belonging to filesystems that do not use the
buffer cache may trigger assertion failures.

Reported by: Fabien Keil

sys/kern/vfs_default.c

index d0074d3e34ed73a7709a1c6f73973aba275a1018..6ee094b9144b189c18296cbe11235fe2f9fa77e4 100644 (file)
@@ -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);
                /*