summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2011-05-06 01:29:14 +0000
committerrmacklem <rmacklem@FreeBSD.org>2011-05-06 01:29:14 +0000
commite4e59a6cee21f1c822331285e993f57317404cae (patch)
tree36cbd1c1161c523e53fdbf3d8d195166fc1a4bfc /sys/fs
parent2dd713ebf4fcfbbc0cd361668793fa76861d0fff (diff)
downloadFreeBSD-src-e4e59a6cee21f1c822331285e993f57317404cae.zip
FreeBSD-src-e4e59a6cee21f1c822331285e993f57317404cae.tar.gz
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. MFC after: 2 weeks
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/nfsserver/nfs_nfsdport.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c
index 90e7d4f..9ea077d 100644
--- a/sys/fs/nfsserver/nfs_nfsdport.c
+++ b/sys/fs/nfsserver/nfs_nfsdport.c
@@ -1280,8 +1280,23 @@ nfsvno_fsync(struct vnode *vp, u_int64_t off, int cnt, struct ucred *cred,
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);
}
/*
OpenPOWER on IntegriCloud