HomeFreeBSD

Handle partial reads in zfs_read

Description

Handle partial reads in zfs_read

Currently, dmu_read_uio_dnode can read 64K of a requested 1M in one
loop, get EFAULT back from zfs_uiomove() (because the iovec only holds
64k), and return EFAULT, which turns into EAGAIN on the way out. EAGAIN
gets interpreted as "I didn't read anything", the caller tries again
without consuming the 64k we already read, and we're stuck.

This apparently works on newer kernels because the caller which breaks
on older Linux kernels by happily passing along a 1M read request and a
64k iovec just requests 64k at a time.

With this, we now won't return EFAULT if we got a partial read.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #12370
Closes #12509
Closes #12516

Details

Provenance
rincebrain_gmail.comAuthored on Sep 20 2021, 5:30 PM
GitHub <noreply@github.com>Committed on Sep 20 2021, 5:30 PM
Parents
rG1d901c3ee596: Upstream: unmount snapshots before destroying them on macOS
Branches
Unknown
Tags
Unknown
Reverted By
rG70f51f0e474f: Revert "Handle partial reads in zfs_read"