From nobody Wed Aug 5 02:17:52 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 4hFDb9454fz6JNNj for ; Wed, 05 Aug 2026 02:17:57 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hFDb93SPYz4Khg for ; Wed, 05 Aug 2026 02:17:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785896277; 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=hXS8L/okAIKO1caqGfIlj6POfJosqIbb6z36RDeK++8=; b=QKObuXEzHV5yrCROEm1EzHXFU/4yUkgNyJjTxTY5wqb/2byQr/iW0T3eBeI/YZcwZQq6/S DReKaWnT3R7fmsc/D5TObzZehskljWV4usmkxhCdcwHw6EUvSAsXbNvmc7e5I0Yq6f17Sl frPqIDyuMJ232VhzitoyW9DhLI7uXjVOM4PS9qRyd6menCj8kgu3JtqZp6Gk2Jehz+1mpa 27FdP9IYuMhkyMPIQHXcimLTrk7g5mF4xFDeSKBucMQV7aaOp8HSiiVcxnDsgaY3dBfqp5 6Gm7K3ma9JmD+xwRVd0/x0rkTQvY6+OhtKw0XNwPFz7cyBXZRdhqXWVgncaWWA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785896277; a=rsa-sha256; cv=none; b=s88GWa2w+ufaZm1tOOGXyD2lEgxQlHJr2y2EQD/wWIxLIAmi+pv+X0+6+a2K5XiS+xPDsF DUsrrEG5wVJ8nAXPGkdVnyAzF1A77jvi4Z7yJg2yoJu+LpCX8C+G/gY0o5M/O3z4TkjM4J CBD5hjVFnhmenoHNw6/9w7x3oY7wttWKMCSmV+zzNXt/GiOokmDbb5ssfmXi5jaePoz98F 5OCDZDMDIQsbPD0WrQ8l7A+NrOuAJSndeRdGWkqlCbfDnf/ryXgRnDuSEVFZQE6L11CYMj 2ebuZSLSy67o1nuvVOsusczkj4OTVSuSLpGeDAPgrep4ll02FCgLqU9qpghKVA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785896277; 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=hXS8L/okAIKO1caqGfIlj6POfJosqIbb6z36RDeK++8=; b=YM0qMxW7oXBUdSaiFf7C1IfZyeuxStc3rpVRkaN9tTSsI6Vs2znhSMt4cpMdNxaM2XO9li v5squihgQZb9PGHdV1yXQUdZFCSW1b3AHVUF+zkIMWiaqnpzgzwK4rFwq00emanrbdkv/1 SByv7V7VDUDQf9kuj6zXGKoDXxRS8Cj44QtPLYGrHJInLjgRLWc4UOMRIvssvNoZDYslcE 1quJW5uu5Co+dmxSVZ+Ogd6UtwfAWAUI8Oy847cj1eq7TSj5xjz+wxYkb2zJBHcWSkMThk c4TFLBb523BbZxE+vDRkBUMEoUiYt8ybjeNZXzVnLXAlH5XHgW0nx/FXegkR7A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hFDb92Jn0z1Chq for ; Wed, 05 Aug 2026 02:17:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ace4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 05 Aug 2026 02:17:52 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: a4ebad0c202f - stable/14 - fusefs: better handling for low-memory conditions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: 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: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a4ebad0c202f5c2d08381d2ac732729cd386388f Auto-Submitted: auto-generated Date: Wed, 05 Aug 2026 02:17:52 +0000 Message-Id: <6a729d50.3ace4.75ad93e2@gitrepo.freebsd.org> The branch stable/14 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=a4ebad0c202f5c2d08381d2ac732729cd386388f commit a4ebad0c202f5c2d08381d2ac732729cd386388f Author: Alan Somers AuthorDate: 2026-03-30 14:22:07 +0000 Commit: Alan Somers CommitDate: 2026-08-05 01:55:00 +0000 fusefs: better handling for low-memory conditions Under conditions of low memory, getblk can fail. fusefs was not handling those failures very systematically. It was always using PCATCH, which appears to have been originally copy/pasted from the NFS client code, but isn't always appropriate: * During fuse_vnode_setsize_immediate, which can be called from many different VOPs and from the vn_delayed_setsize mechanism, remove PCATCH. Some of these callers cannot tolerate allocate failure. * In fuse_inval_buf_range, don't assume that getblk will always succeed. * When calling fuse_inval_buf_range from VOP_ALLOCATE, VOP_COPY_FILE_RANGE, or VOP_WRITE (with IO_DIRECT), return EINTR if the allocation fails. * When calling fuse_inval_buf_range from VOP_DEALLOCATE, remove PCATCH. This VOP must not fail with EINTR. No new tests, because I can't force any particular getblk call to fail. PR: 293957 Sponsored by: ConnectWise Reported by: zjk7@wp.pl (cherry picked from commit 374548e930bd9452351059c14e697036d903b1c4) --- sys/fs/fuse/fuse_node.c | 6 +----- sys/fs/fuse/fuse_vnops.c | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/sys/fs/fuse/fuse_node.c b/sys/fs/fuse/fuse_node.c index c0ec6b202c6e..3119e0096179 100644 --- a/sys/fs/fuse/fuse_node.c +++ b/sys/fs/fuse/fuse_node.c @@ -465,11 +465,7 @@ fuse_vnode_setsize(struct vnode *vp, off_t newsize, bool from_server) */ lbn = newsize / iosize; - bp = getblk(vp, lbn, iosize, PCATCH, 0, 0); - if (!bp) { - err = EINTR; - goto out; - } + bp = getblk(vp, lbn, iosize, 0, 0, 0); if (!(bp->b_flags & B_CACHE)) goto out; /* Nothing to do */ MPASS(bp->b_flags & B_VMIO); diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index ba72a21c8efe..ad246049949d 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -319,7 +319,8 @@ fuse_fifo_close(struct vop_close_args *ap) /* Invalidate a range of cached data, whether dirty of not */ static int -fuse_inval_buf_range(struct vnode *vp, off_t filesize, off_t start, off_t end) +fuse_inval_buf_range(struct vnode *vp, off_t filesize, off_t start, off_t end, + int slpflag) { struct buf *bp; daddr_t left_lbn, end_lbn, right_lbn; @@ -331,7 +332,9 @@ fuse_inval_buf_range(struct vnode *vp, off_t filesize, off_t start, off_t end) end_lbn = howmany(end, iosize); left_on = start & (iosize - 1); if (left_on != 0) { - bp = getblk(vp, left_lbn, iosize, PCATCH, 0, 0); + bp = getblk(vp, left_lbn, iosize, slpflag, 0, 0); + if (!bp) + return (EINTR); if ((bp->b_flags & B_CACHE) != 0 && bp->b_dirtyend >= left_on) { /* * Flush the dirty buffer, because we don't have a @@ -350,7 +353,9 @@ fuse_inval_buf_range(struct vnode *vp, off_t filesize, off_t start, off_t end) right_lbn = end / iosize; new_filesize = MAX(filesize, end); right_blksize = MIN(iosize, new_filesize - iosize * right_lbn); - bp = getblk(vp, right_lbn, right_blksize, PCATCH, 0, 0); + bp = getblk(vp, right_lbn, right_blksize, slpflag, 0, 0); + if (!bp) + return (EINTR); if ((bp->b_flags & B_CACHE) != 0 && bp->b_dirtyoff < right_on) { /* * Flush the dirty buffer, because we don't have a @@ -635,7 +640,10 @@ fuse_vnop_allocate(struct vop_allocate_args *ap) err = fuse_vnode_size(vp, &filesize, cred, curthread); if (err) return (err); - fuse_inval_buf_range(vp, filesize, *offset, *offset + *len); + err = fuse_inval_buf_range(vp, filesize, *offset, *offset + *len, + PCATCH); + if (err) + return (err); fdisp_init(&fdi, sizeof(*ffi)); fdisp_make_vp(&fdi, FUSE_FALLOCATE, vp, curthread, cred); @@ -919,7 +927,7 @@ fuse_vnop_copy_file_range(struct vop_copy_file_range_args *ap) vnode_pager_clean_sync(invp); err = fuse_inval_buf_range(outvp, outfilesize, *ap->a_outoffp, - *ap->a_outoffp + io.uio_resid); + *ap->a_outoffp + io.uio_resid, PCATCH); if (err) goto unlock; @@ -2514,7 +2522,7 @@ fuse_vnop_write(struct vop_write_args *ap) end = start + uio->uio_resid; if (!pages) { err = fuse_inval_buf_range(vp, filesize, start, - end); + end, PCATCH); if (err) goto out; } @@ -3031,7 +3039,9 @@ fuse_vnop_deallocate(struct vop_deallocate_args *ap) err = fuse_vnode_size(vp, &filesize, cred, curthread); if (err) goto out; - fuse_inval_buf_range(vp, filesize, *offset, *offset + *len); + err = fuse_inval_buf_range(vp, filesize, *offset, *offset + *len, 0); + if (err) + goto out; fdisp_init(&fdi, sizeof(*ffi)); fdisp_make_vp(&fdi, FUSE_FALLOCATE, vp, curthread, cred);