git: e8b9bd97e3cb - stable/14 - vop_stdadvise(): restore correct handling of length == 0
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Sep 2024 01:01:02 UTC
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e8b9bd97e3cb1f58d4a4514c48d2fb4d49380511 commit e8b9bd97e3cb1f58d4a4514c48d2fb4d49380511 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-09-03 04:20:40 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-09-11 08:44:01 +0000 vop_stdadvise(): restore correct handling of length == 0 (cherry picked from commit 79eba754bec39d88a6494318a2176d19743cf993) --- sys/kern/vfs_default.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index e5c37433a77d..c2bded76f6dc 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1066,8 +1066,8 @@ vop_stdadvise(struct vop_advise_args *ap) { struct vnode *vp; struct bufobj *bo; + uintmax_t bstart, bend; daddr_t startn, endn; - off_t bstart, bend, start, end; int bsize, error; vp = ap->a_vp; @@ -1099,7 +1099,8 @@ vop_stdadvise(struct vop_advise_args *ap) */ bsize = vp->v_bufobj.bo_bsize; bstart = rounddown(ap->a_start, bsize); - bend = roundup(ap->a_end, bsize); + bend = ap->a_end; + bend = roundup(bend, bsize); /* * Deactivate pages in the specified range from the backing VM @@ -1108,18 +1109,17 @@ vop_stdadvise(struct vop_advise_args *ap) * below. */ if (vp->v_object != NULL) { - start = trunc_page(bstart); - end = round_page(bend); VM_OBJECT_RLOCK(vp->v_object); - vm_object_page_noreuse(vp->v_object, OFF_TO_IDX(start), - OFF_TO_IDX(end)); + vm_object_page_noreuse(vp->v_object, + OFF_TO_IDX(trunc_page(bstart)), + OFF_TO_IDX(round_page(bend))); VM_OBJECT_RUNLOCK(vp->v_object); } bo = &vp->v_bufobj; - BO_RLOCK(bo); startn = bstart / bsize; endn = bend / bsize; + BO_RLOCK(bo); error = bnoreuselist(&bo->bo_clean, bo, startn, endn); if (error == 0) error = bnoreuselist(&bo->bo_dirty, bo, startn, endn);