From owner-svn-src-all@FreeBSD.ORG Fri May 20 00:51:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 841CA106566B; Fri, 20 May 2011 00:51:52 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 729FA8FC15; Fri, 20 May 2011 00:51:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4K0pqUr060104; Fri, 20 May 2011 00:51:52 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4K0pqxg060102; Fri, 20 May 2011 00:51:52 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201105200051.p4K0pqxg060102@svn.freebsd.org> From: Rick Macklem Date: Fri, 20 May 2011 00:51:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222109 - stable/8/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 May 2011 00:51:52 -0000 Author: rmacklem Date: Fri May 20 00:51:52 2011 New Revision: 222109 URL: http://svn.freebsd.org/changeset/base/222109 Log: MFC: r221517 Change the new NFS server so that it returns 0 when the f_bavail or f_ffree fields of "struct statfs" are negative, since the values that go on the wire are unsigned and will appear to be very large positive values otherwise. This makes the handling of a negative f_bavail compatible with the old/regular NFS server. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Thu May 19 23:18:42 2011 (r222108) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Fri May 20 00:51:52 2011 (r222109) @@ -1277,8 +1277,23 @@ nfsvno_fsync(struct vnode *vp, u_int64_t int nfsvno_statfs(struct vnode *vp, struct statfs *sf) { + int error; - return (VFS_STATFS(vp->v_mount, sf)); + error = VFS_STATFS(vp->v_mount, sf); + if (error == 0) { + /* + * 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 (sf->f_bavail < 0) + sf->f_bavail = 0; + if (sf->f_ffree < 0) + sf->f_ffree = 0; + } + return (error); } /*