git: 82817f26f8ec - main - ffs: fix vn_io_fault_pgmove() offset for PAGE_SIZE > block size

From: Chuck Silvers <chs_at_FreeBSD.org>
Date: Wed, 22 Jun 2022 00:56:00 UTC
The branch main has been updated by chs:

URL: https://cgit.FreeBSD.org/src/commit/?id=82817f26f8ecf5a3c43a8ad51737731a9b9764de

commit 82817f26f8ecf5a3c43a8ad51737731a9b9764de
Author:     Chuck Silvers <chs@FreeBSD.org>
AuthorDate: 2022-06-22 00:54:18 +0000
Commit:     Chuck Silvers <chs@FreeBSD.org>
CommitDate: 2022-06-22 00:54:18 +0000

    ffs: fix vn_io_fault_pgmove() offset for PAGE_SIZE > block size
    
    The "offset" argument to vn_io_fault_pgmove() is supposed to be
    the offset within the page, but for ffs we currently use the offset
    within the block.  When the block size is at least as large as the
    page size then these values are the same, but when the page size is
    larger than the block size then we need to add the offset of
    the block within the page as well.
    
    Sponsored by:   Netflix
    
    Reviewed by:    mckusick, kib, markj
    Differential Revision:  https://reviews.freebsd.org/D34835
---
 sys/ufs/ffs/ffs_vnops.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index b57e9a3a71b0..c3f63bbfc44f 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -795,7 +795,8 @@ ffs_read(ap)
 			error = vn_io_fault_uiomove((char *)bp->b_data +
 			    blkoffset, (int)xfersize, uio);
 		} else {
-			error = vn_io_fault_pgmove(bp->b_pages, blkoffset,
+			error = vn_io_fault_pgmove(bp->b_pages,
+			    blkoffset + (bp->b_offset & PAGE_MASK),
 			    (int)xfersize, uio);
 		}
 		if (error)
@@ -947,7 +948,8 @@ ffs_write(ap)
 			error = vn_io_fault_uiomove((char *)bp->b_data +
 			    blkoffset, (int)xfersize, uio);
 		} else {
-			error = vn_io_fault_pgmove(bp->b_pages, blkoffset,
+			error = vn_io_fault_pgmove(bp->b_pages,
+			    blkoffset + (bp->b_offset & PAGE_MASK),
 			    (int)xfersize, uio);
 		}
 		/*