The branch main has been updated by kib:

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

commit bdb46c21a3e68d4395d6e0b6a205187e655532b0
Author:     Konstantin Belousov <k...@freebsd.org>
AuthorDate: 2024-01-08 13:21:06 +0000
Commit:     Konstantin Belousov <k...@freebsd.org>
CommitDate: 2024-01-11 09:49:37 +0000

    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
---
 sys/vm/vnode_pager.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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;

Reply via email to