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
This commit is contained in:
Mark Johnston 2015-10-01 16:34:53 +00:00
parent 6ac1446d0e
commit 0a19cfd454

@ -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);
/*