FreeBSD: Return Mach error codes from VOP_(GET|PUT)PAGES

FreeBSD's memory management system uses its own error numbers and gets
confused when these VOPs return EIO.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reported-by: Peter Holm <pho@FreeBSD.org>
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Closes #13311
This commit is contained in:
Mark Johnston 2022-04-07 17:13:18 -04:00 committed by Brian Behlendorf
parent e9cd90f6e5
commit b7546f92ea
1 changed files with 7 additions and 8 deletions

View File

@ -4062,8 +4062,8 @@ zfs_getpages(struct vnode *vp, vm_page_t *ma, int count, int *rbehind,
int pgsin_b, pgsin_a; int pgsin_b, pgsin_a;
int error; int error;
ZFS_ENTER(zfsvfs); ZFS_ENTER_ERROR(zfsvfs, zfs_vm_pagerret_error);
ZFS_VERIFY_ZP(zp); ZFS_VERIFY_ZP_ERROR(zp, zfs_vm_pagerret_error);
start = IDX_TO_OFF(ma[0]->pindex); start = IDX_TO_OFF(ma[0]->pindex);
end = IDX_TO_OFF(ma[count - 1]->pindex + 1); end = IDX_TO_OFF(ma[count - 1]->pindex + 1);
@ -4187,19 +4187,18 @@ zfs_putpages(struct vnode *vp, vm_page_t *ma, size_t len, int flags,
int err; int err;
int i; int i;
ZFS_ENTER(zfsvfs);
ZFS_VERIFY_ZP(zp);
object = vp->v_object; object = vp->v_object;
pcount = btoc(len);
ncount = pcount;
KASSERT(ma[0]->object == object, ("mismatching object")); KASSERT(ma[0]->object == object, ("mismatching object"));
KASSERT(len > 0 && (len & PAGE_MASK) == 0, ("unexpected length")); KASSERT(len > 0 && (len & PAGE_MASK) == 0, ("unexpected length"));
pcount = btoc(len);
ncount = pcount;
for (i = 0; i < pcount; i++) for (i = 0; i < pcount; i++)
rtvals[i] = zfs_vm_pagerret_error; rtvals[i] = zfs_vm_pagerret_error;
ZFS_ENTER_ERROR(zfsvfs, zfs_vm_pagerret_error);
ZFS_VERIFY_ZP_ERROR(zp, zfs_vm_pagerret_error);
off = IDX_TO_OFF(ma[0]->pindex); off = IDX_TO_OFF(ma[0]->pindex);
blksz = zp->z_blksz; blksz = zp->z_blksz;
lo_off = rounddown(off, blksz); lo_off = rounddown(off, blksz);