Date: Wed, 15 Sep 2021 23:05:15 GMT From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: e5d000b33383 - stable/13 - nfsd: Make loop calling VOP_ALLOCATE() iterate until done Message-ID: <202109152305.18FN5FVG045197@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=e5d000b333830ad2795ec3a265b3d2f499b4065c commit e5d000b333830ad2795ec3a265b3d2f499b4065c Author: Rick Macklem <rmacklem@FreeBSD.org> AuthorDate: 2021-08-29 23:46:27 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109152305.18FN5FVG045197>