git: ce139f7da00c - releng/14.5 - geom_zero(4): reset the uio vector on each uiomove()
Colin Percival <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.src |
|---|---|
| Message-ID | <6a7d0b18.1dd07.623b5da6__1016.86869036115$1786579774$gmane$org@gitrepo.freebsd.org> |
The branch releng/14.5 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=ce139f7da00c5040e41219f048ec2fc7299d1cb9 commit ce139f7da00c5040e41219f048ec2fc7299d1cb9 Author: Konstantin Belousov <[email protected]> AuthorDate: 2026-07-26 21:45:07 +0000 Commit: Colin Percival <[email protected]> CommitDate: 2026-08-13 00:08:18 +0000 geom_zero(4): reset the uio vector on each uiomove() PR: 297062 Approved by: re (cperciva) (cherry picked from commit 34ca5a9e7362b0c820fe339daa2b8d06c58b6fea) (cherry picked from commit 51f5623874c0c2b8e5adb2e02313ac6f41229d31) --- sys/geom/zero/g_zero.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/geom/zero/g_zero.c b/sys/geom/zero/g_zero.c index 6af29ca117ab..99c799d6f082 100644 --- a/sys/geom/zero/g_zero.c +++ b/sys/geom/zero/g_zero.c @@ -84,11 +84,6 @@ g_zero_fill_pages(struct bio *bp) size_t length; vm_offset_t offset; - aiovec.iov_base = g_zero_buffer; - aiovec.iov_len = PAGE_SIZE; - auio.uio_iov = &aiovec; - auio.uio_iovcnt = 1; - auio.uio_offset = 0; auio.uio_segflg = UIO_SYSSPACE; auio.uio_rw = UIO_WRITE; auio.uio_td = curthread; @@ -102,6 +97,12 @@ g_zero_fill_pages(struct bio *bp) bp->bio_resid = bp->bio_length; offset = bp->bio_ma_offset & PAGE_MASK; for (int i = 0; i < bp->bio_ma_n && bp->bio_resid > 0; i++) { + aiovec.iov_base = g_zero_buffer; + aiovec.iov_len = PAGE_SIZE; + auio.uio_iov = &aiovec; + auio.uio_iovcnt = 1; + auio.uio_offset = 0; + length = MIN(PAGE_SIZE - offset, bp->bio_resid); auio.uio_resid = length;