From nobody Tue Nov 17 21:11:26 2026 X-Original-To: dev-commits-src-all@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 4jTcq35qXZz71sjv for ; Tue, 17 Nov 2026 21:11:27 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jTcq30Q1rz4Fqm for ; Tue, 17 Nov 2026 21:11:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794949887; 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=MfTHeU2DhH4OEDfEkQBFNV+4xlQcXOwaSxJiX2mhErw=; b=qgF+C4UJPpjNjCN7HVurhfo6bbntzDfLJSbnk8jh9Oigwda98H/0LSQH1ZK2WVWHM5zSDO wYxAwTv/CP9JIdNHtBCxaHbb7UPZ4p4m1bzcbSO6dbk9vj1T7pNKjxH7wT93TuQvKLYI4l jSPGWOIWApMTOFiOaZxpBp3OMZl/+TyJ1K+iSF+bfmnOjudSNni90Co09JxwIFzQQOsWKl pPkjXDO9FsRv+9hQCULHyneXDocPzbfQZemrhfmDJANr8HYCmlu9jdEzOFqN804zSgdOZZ RuJeZnCjPcQKEWIEeDCrZNkYTaaJTW27nBm2CXuS4CEF5qN6nsxDLK9rEifErg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794949887; b=lD7FRYw3u5kpvKph4yMHI8qrx/4dwC8wODFCemv0Y9sspLdSkkWK0ezV+JATGEHZ2Sj8BA 7wqX59u71HsLF5HNveTYYuKx9caOZDQ0h4eAzoBQCsMsuXR/Y8X7HDw4Musgb7W0HIrQRY sGrIMEV1t5zugotwg/GtOlPp0DpsIHfqBmlJpR4/gqh+qq0eo6cxNPq/yZ/fUSVO8pxybO DDaBkCyzQkR/m30yDK4NMp5T5vDTNwsuCxBNMmJ02l9pbHNdOskruDZTcTaszaqideDDL+ rZWcpndywdgTOVU+Y7rcP2RjXvBCDJ8QDRNG02n4o5OVkY1QEtmiwhGg5MtdCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794949887; 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=MfTHeU2DhH4OEDfEkQBFNV+4xlQcXOwaSxJiX2mhErw=; b=VED7ik9fkCH3qx9Rx01FhwGSLRNZLIEK4I1sVUmV5lhf6dyc110wkL70Xzdfka0AdTPbpx 1QEzg1baJ2TaJ/kCum3Q5k4toO8qTxphCXFPVvrrhQH6XeyNPEtNn4BGPV2mq51WVWhS4J rZ0NFIbnwL96NjxOKyjtaU+8fcMRwiPYuddZX6WM7aVWwENPrsuED9zXgbdCInERdp5l4S +RKp6s4Zo/WBfp66auOQAhLUqkPBLvlx891gUV7BF7B0bOQ4W49M+foixdOjKpnYQv03oZ 5TXLR8pZI3ovL7nPDjf/f6V1K0p6ul+yDkTcWXX9/EJwIwoTh3edSUUO7gnyUg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jTcq26W4bz1043 for ; Tue, 17 Nov 2026 21:11:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1a24e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 17 Nov 2026 21:11:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 8bee7ea63a6a - main - vfs: fail VOP_ALLOCATE passes that make no progress List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8bee7ea63a6a0d65a95df781504d445486fd7dd4 Auto-Submitted: auto-generated Date: Tue, 17 Nov 2026 21:11:26 +0000 Message-Id: <6afcc2fe.1a24e.50679953@gitrepo.freebsd.org> The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=8bee7ea63a6a0d65a95df781504d445486fd7dd4 commit 8bee7ea63a6a0d65a95df781504d445486fd7dd4 Author: Kyle Evans AuthorDate: 2026-11-17 21:10:38 +0000 Commit: Kyle Evans CommitDate: 2026-11-17 21:11:05 +0000 vfs: fail VOP_ALLOCATE passes that make no progress vn_fallocate() loops over VOP_ALLOCATE until the requested range has been allocated, permitting partial results. It only asserts that each pass makes progress, so on a non-INVARIANTS kernel a filesystem that returns success without shrinking the remaining length leaves the caller spinning forever. Drop the assertion and just return EIO in that case, as was just done for vn_deallocate_impl(). The NFS server already does the same in its own VOP_ALLOCATE loop. Document the progress requirement in VOP_ALLOCATE(9) and the new EIO condition in posix_fallocate(2). Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D61497 --- lib/libsys/posix_fallocate.2 | 4 +++- share/man/man9/VOP_ALLOCATE.9 | 9 +++++++-- sys/kern/vfs_vnops.c | 13 ++++++++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/libsys/posix_fallocate.2 b/lib/libsys/posix_fallocate.2 index 94858c4a0f90..ae1fdc035480 100644 --- a/lib/libsys/posix_fallocate.2 +++ b/lib/libsys/posix_fallocate.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd November 2, 2025 +.Dd November 12, 2026 .Dt POSIX_FALLOCATE 2 .Os .Sh NAME @@ -108,6 +108,8 @@ argument was less than or equal to zero, the argument was less than zero. .It Bq Er EIO An I/O error occurred while reading from or writing to a file system. +.It Bq Er EIO +The file system failed to make progress on the requested allocation. .It Bq Er EINTEGRITY Corrupted data was detected while reading from the file system. .It Bq Er ENODEV diff --git a/share/man/man9/VOP_ALLOCATE.9 b/share/man/man9/VOP_ALLOCATE.9 index 4fcbe773f236..956800d643d7 100644 --- a/share/man/man9/VOP_ALLOCATE.9 +++ b/share/man/man9/VOP_ALLOCATE.9 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd November 8, 2021 +.Dd November 12, 2026 .Dt VOP_ALLOCATE 9 .Os .Sh NAME @@ -68,7 +68,12 @@ and .Fa len arguments are updated to reflect the portion of the range that still needs to be allocated on return. -A partial allocation is considered a successful operation. +A partial allocation is considered a successful operation, provided that +some progress was made: +a successful return must decrease +.Fa *len , +or the caller will fail the request with +.Er EIO . The file's contents are not changed. .Sh LOCKS The file should be exclusively locked on entry and will still be locked on exit. diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index fa579de2b83a..dbef4b520717 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -3996,7 +3996,18 @@ vn_fallocate(struct file *fp, off_t offset, off_t len, struct thread *td) } if (error != 0 || len == 0) break; - KASSERT(olen > len, ("Iteration did not make progress?")); + + /* + * A partial result is permitted, but each pass must make some + * progress or we would spin here forever. + */ + if (len >= olen) { + error = EXTERROR(EIO, + "no progress on vp %p (off %jd)", + vp, (intmax_t)ooffset); + break; + } + maybe_yield(); }