ZFS: Fix a logic bug in the FreeBSD getpages VOP

This was introduced when I merged r361287 to OpenZFS and has been fixed
there already, commit 3f6bb6e43fd68e.

Reported by:	swills
Reviewed by:	allanjude, freqlabs, mmacy
This commit is contained in:
Mark Johnston 2020-09-29 13:41:47 +00:00
parent 39e75a5a79
commit 752c1d14e3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=366252

View File

@ -4859,7 +4859,8 @@ zfs_getpages(struct vnode *vp, vm_page_t *ma, int count, int *rbehind,
obj_size = object->un_pager.vnp.vnp_size;
zfs_vmobject_wunlock(object);
if (IDX_TO_OFF(ma[count - 1]->pindex) >= obj_size) {
zfs_rangelock_exit(lr);
if (lr != NULL)
zfs_rangelock_exit(lr);
ZFS_EXIT(zfsvfs);
return (zfs_vm_pagerret_bad);
}
@ -4887,7 +4888,8 @@ zfs_getpages(struct vnode *vp, vm_page_t *ma, int count, int *rbehind,
error = dmu_read_pages(os, zp->z_id, ma, count, &pgsin_b, &pgsin_a,
MIN(end, obj_size) - (end - PAGE_SIZE));
zfs_rangelock_exit(lr);
if (lr != NULL)
zfs_rangelock_exit(lr);
ZFS_ACCESSTIME_STAMP(zfsvfs, zp);
ZFS_EXIT(zfsvfs);