mirror of
https://github.com/opnsense/src.git
synced 2026-04-22 06:39:32 -04:00
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:
parent
6ac1446d0e
commit
0a19cfd454
1 changed files with 9 additions and 10 deletions
|
|
@ -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);
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue