diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2024-01-08 13:21:06 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2024-01-11 09:49:37 +0000 |
| commit | bdb46c21a3e68d4395d6e0b6a205187e655532b0 (patch) | |
| tree | 1027122d5190bf928aeee2ea78cac6a22ef8270b | |
| parent | d9b1f6fbf9935a9d54c78987a04af7cda3740c56 (diff) | |
| download | src-bdb46c21a3e68d4395d6e0b6a205187e655532b0.tar.gz src-bdb46c21a3e68d4395d6e0b6a205187e655532b0.zip | |
vnode_pager_generic_putpages(): correctly handle clean block at EOF
The loop 'skip clean blocks' checking for the clean blocks in the dirty
pages might end up setting the in_hole to true when exactly at EOF at
the middle of the block, without advancing the prev_offset value. Then
the next block is not dirty, and next_offset is clipped back to poffset
+ maxsize, equal to prev_offset, failing the assertion.
Instead of asserting prev_offset < next_offset, we must skip the write.
Reported by: asomers
PR: 276191
Reviewed by: alc, markj
Tested by: asomers
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D43358
| -rw-r--r-- | sys/vm/vnode_pager.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index bf5166e059e9..75919625707c 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -1464,12 +1464,13 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page_t *ma, int bytecount, start_write: if (next_offset > poffset + maxsize) next_offset = poffset + maxsize; + if (prev_offset == next_offset) + goto write_done; /* * Getting here requires finding a dirty block in the * 'skip clean blocks' loop. */ - MPASS(prev_offset < next_offset); aiov.iov_base = NULL; auio.uio_iovcnt = 1; |
