vn_vmap_seekhole(): align running offset to the block boundary.

Otherwise we might miss the last iteration where EOF appears below
unaligned noff.

Reported and reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D19811
This commit is contained in:
Konstantin Belousov 2019-04-05 16:14:16 +00:00
parent a5a02ef49f
commit 4ae3f5a7fd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345955

View File

@ -2167,7 +2167,8 @@ vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, struct ucred *cred)
goto unlock;
}
bsize = vp->v_mount->mnt_stat.f_iosize;
for (bn = noff / bsize; noff < va.va_size; bn++, noff += bsize) {
for (bn = noff / bsize; noff < va.va_size; bn++, noff += bsize -
noff % bsize) {
error = VOP_BMAP(vp, bn, NULL, &bnp, NULL, NULL);
if (error == EOPNOTSUPP) {
error = ENOTTY;