From nobody Thu Jan 11 09:50:17 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T9fzZ0LKhz572fd; Thu, 11 Jan 2024 09:50:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T9fzY6wbzz4kmx; Thu, 11 Jan 2024 09:50:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704966618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dg/hf83nzR/5mSxQ7momCFrEOhEJ8XNFVh7wCuN8eG4=; b=id2jv2YzN2YXRNeOwQYZjRoErkHC02RKmkgCOIjTZcFcjN8jadpKgSdwCyvkVdMN7i4omW wXZKrrvGxRqrYgWkK6W9XPj1MVawkhPaGlX3SP9rp9VAtn2bOeOEawgh7UK5sPC2s0EEW5 la9tPDvWTwsmdulQxBRT9wiKVQiA5R8b/hdhWYzNi1gjpqVbjKFVOeoKGKMJ4qviORME7m GHD8Zbbn2nCeEscK8PgAES6XcB4P3olQVgb/It56rWkyK2efXS/bv8ZfGxU3pCWqQFImjx HfGsAsj69jM2GDD5bIjcmmCf58cGp69cMom5Eai/RuHV7eHZbcCAIJgg38PuZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704966618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dg/hf83nzR/5mSxQ7momCFrEOhEJ8XNFVh7wCuN8eG4=; b=MCesoMkxl8H8711e9+hoolEKqx39GsaYsol0qehVB86yr7MRwbSa7bndqXMdiyt8mqtRxQ MCiLKtgVEg2uoOrMHiFjCwd7RCs4MEBsD9mA276MtstLnPAkOM0Oee/wvieRg4GFkZmh3+ 24EetJNg5JPHJnGo0W4zxQgm9pNxrJlw9HZHqmXKbDd4OOp8iQbnQn6tqfc+ESJB18/g7g vAobLbLJa+UZjaM7i+CK11edKhql6ouZHcbiHfne1GziGZ5swdmmpQVc7GKNbhyzau8O2Q uRpWFs8lwji4+tucmA0Q4Sv4FVdQJfdmYePnl9B21kMOde65cFxBkcH7E+AENw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704966618; a=rsa-sha256; cv=none; b=SmGgbNSWAp9Jo9tQQkCS1TD95AWubodXTQJfup7m+b52slzUqQ6ptx743wZVm+x4B/8IZI lzgcBWTbx30/WRboRPzGbNfAlKz/vuhL8r0E9K2kI8mKOgxtyWqptSqwAtGjKjt9cT1VPk PQI5SrO++3amPo8ltf4uMomdsJszFwUlXq+9m0cQ6HJyTM/Rkh/KtauwtoGYBu5zZSJ7Na wb59X4norieTvFF/dHrn0c7/Ed9/Fcw4D3sAFPk0T22bhXi1JAZSTdiURzc1mCBqtcOWNg vkdJM1v6K06FWMohvZlChvUu3vZ6W0gepaCjEriHFN+n4dHFMfgdlWWE6t3BUA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T9fzY5ztmz1Cp9; Thu, 11 Jan 2024 09:50:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40B9oHxW041447; Thu, 11 Jan 2024 09:50:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40B9oH0s041441; Thu, 11 Jan 2024 09:50:17 GMT (envelope-from git) Date: Thu, 11 Jan 2024 09:50:17 GMT Message-Id: <202401110950.40B9oH0s041441@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: bdb46c21a3e6 - main - vnode_pager_generic_putpages(): correctly handle clean block at EOF List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bdb46c21a3e68d4395d6e0b6a205187e655532b0 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bdb46c21a3e68d4395d6e0b6a205187e655532b0 commit bdb46c21a3e68d4395d6e0b6a205187e655532b0 Author: Konstantin Belousov AuthorDate: 2024-01-08 13:21:06 +0000 Commit: Konstantin Belousov 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;