From nobody Wed Nov 24 22:34:53 2021 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 B548518AF08A; Wed, 24 Nov 2021 22:34:53 +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 4Hzwms2cB3z4rXM; Wed, 24 Nov 2021 22:34:53 +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 397AF123B6; Wed, 24 Nov 2021 22:34:53 +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 1AOMYrfw016415; Wed, 24 Nov 2021 22:34:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AOMYrwY016414; Wed, 24 Nov 2021 22:34:53 GMT (envelope-from git) Date: Wed, 24 Nov 2021 22:34:53 GMT Message-Id: <202111242234.1AOMYrwY016414@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: 3f539826e12e - stable/13 - nfsd: Fix f_bavail and f_ffree for NFSv4 when negative 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 3f539826e12e3177655add03f6297f49019ac08b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637793293; 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=r7lwS9BumkqJVAHZ9TS954/+iyQUE2r1/NKRm71HD7g=; b=e/xuSIX2MgMTfqPozMofMT5oFn3wtFjSjNTh+dWPXmAditex1iCSn9Xv5qNPv3JtTmywwr WfsQhZoGwq4YhtT6oEWuPljQztiSPS5Tnh28eBilQtymS7qEXyqrj/VbP6F2lk3Lh2vRvw L29a1wc1AErKXaq1XDrGlDUg9JbTC6TENAb5AlYWzu+rgzL9JFzH5OLVTvOt6OS1uwYlaq dT1KWzkRFWcTdn6RT8ZY8krAsXjPoz5RNxj9xNKAlVvTsDyzdrhjUe6L+y40XSvqACqIlt YtKPgWoufkbeKX/yW9h6DSiLs09/cUePC5Bv1I5hQcf55WjAGe5VFEkAvYVrMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637793293; a=rsa-sha256; cv=none; b=T2/kjxoPAfQf3bIFm2piW6/+ZJAWdz0Z74pxXuAb6SAkBFQQABhLYFgG1yR1VFs2+bmq9n hOVxsJz+GYZesSYwLXK8C6I4TuvGfzxHRj/Z8QolaFmmKsw97NMhQ4XAjkgVN/zU6Xf0HA HxaOu7f0Pkm3Be40PvaGAYNiRtPoZZ6Wt8mabFucDynsATswyXvPs7CfxrxDp34oLhbUQD cHpnJUpCB4JXnfBCkzv7DZrYiI5zQmCClX4jeQm+rvfZ8sA3yITpgIh0V6Og4GZdJmBbfy NqTQouNXtlSvT6QWrl/7325VNS0T53ZZnSauwskrg7TkLg6kv9IlfuG89GJwlQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=3f539826e12e3177655add03f6297f49019ac08b commit 3f539826e12e3177655add03f6297f49019ac08b Author: Rick Macklem AuthorDate: 2021-11-08 20:59:31 +0000 Commit: Rick Macklem CommitDate: 2021-11-24 22:31:55 +0000 nfsd: Fix f_bavail and f_ffree for NFSv4 when negative Since the NFS Space_available and Files_available are unsigned, the NFSv3 server sets them to 0 when negative, so that they do not appear to be large positive values for non-FreeBSD clients. This patch fixes the NFSv4 server to do the same. Found during a recent IEFT NFSv4 working group testing event. (cherry picked from commit d70ca5b00eede3367ce659a03b2f9cc9729cd0dd) --- sys/fs/nfs/nfs_commonsubs.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index c8534982ee0e..144b2e215496 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -2511,6 +2511,17 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp, } NFSCLRSTATFS_ATTRBIT(retbitp); } + /* + * Since NFS handles these values as unsigned on the + * wire, there is no way to represent negative values, + * so set them to 0. Without this, they will appear + * to be very large positive values for clients like + * Solaris10. + */ + if (fs->f_bavail < 0) + fs->f_bavail = 0; + if (fs->f_ffree < 0) + fs->f_ffree = 0; } #endif