From owner-dev-commits-src-branches@freebsd.org Wed Sep 15 23:05:16 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A3A866FEC9; Wed, 15 Sep 2021 23:05:16 +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 4H8wmD16K3z3Fkd; Wed, 15 Sep 2021 23:05:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0428F16964; Wed, 15 Sep 2021 23:05:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FN5FiI045199; Wed, 15 Sep 2021 23:05:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FN5FVG045197; Wed, 15 Sep 2021 23:05:15 GMT (envelope-from git) Date: Wed, 15 Sep 2021 23:05:15 GMT Message-Id: <202109152305.18FN5FVG045197@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: e5d000b33383 - stable/13 - nfsd: Make loop calling VOP_ALLOCATE() iterate until done MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e5d000b333830ad2795ec3a265b3d2f499b4065c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 23:05:16 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=e5d000b333830ad2795ec3a265b3d2f499b4065c commit e5d000b333830ad2795ec3a265b3d2f499b4065c Author: Rick Macklem AuthorDate: 2021-08-29 23:46:27 +0000 Commit: Rick Macklem CommitDate: 2021-09-15 23:01:41 +0000 nfsd: Make loop calling VOP_ALLOCATE() iterate until done The NFSv4.2 Deallocate operation loops on VOP_DEALLOCATE() while progress is being made (remaining length decreasing). This patch changes the loop on VOP_ALLOCATE() for the NFSv4.2 Allocate operation do the same, instead of stopping after an arbitrary 20 iterations. (cherry picked from commit 13914e51eb8de6fe9f627c9c1d48c09880b2607e) --- sys/fs/nfsserver/nfs_nfsdport.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index efe9aac7a136..f48e57e449c9 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -6399,7 +6399,8 @@ int nfsvno_allocate(struct vnode *vp, off_t off, off_t len, struct ucred *cred, NFSPROC_T *p) { - int error, trycnt; + int error; + off_t olen; ASSERT_VOP_ELOCKED(vp, "nfsvno_allocate vp"); /* @@ -6410,15 +6411,17 @@ nfsvno_allocate(struct vnode *vp, off_t off, off_t len, struct ucred *cred, NULL, NULL, NULL, NULL, &len, 0, NULL); if (error != ENOENT) return (error); - error = 0; /* - * Do the actual VOP_ALLOCATE(), looping a reasonable number of - * times to achieve completion. + * Do the actual VOP_ALLOCATE(), looping so long as + * progress is being made, to achieve completion. */ - trycnt = 0; - while (error == 0 && len > 0 && trycnt++ < 20) + do { + olen = len; error = VOP_ALLOCATE(vp, &off, &len); + if (error == 0 && len > 0 && olen > len) + maybe_yield(); + } while (error == 0 && len > 0 && olen > len); if (error == 0 && len > 0) error = NFSERR_IO; NFSEXITCODE(error);