Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 May 2011 17:25:11 -0400 (EDT)
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        FreeBSD FS <freebsd-fs@freebsd.org>
Subject:   RFC: NFS server handling of negative f_bavail?
Message-ID:  <1404795089.836227.1304285111779.JavaMail.root@erie.cs.uoguelph.ca>

next in thread | raw e-mail | index | archive | help
Hi,

I recently discovered that there seems to be an issue w.r.t.
the f_bavail and f_ffree fields of "struct statfs" since they
are signed values that can be negative.

The RFCs for NFSv3 and NFSv3 define these fields as unsigned
byte counts when they go on the wire. I read that as implying
that negative values can't be represented for them? I tried
a quick test on Solaris10, but I couldn't get the fields to go
negative (they appear to be unsigned in their "struct statvfs"),
so I couldn't find out what it would have done for negative values.

I can think of 2 ways to go:
1 - Have the server reply 0 for these fields when VFS_STATFS()
    passes negative values up.
    This would seem to conform to the RFCs and seems least likely
    to confuse non-BSD clients.
OR
2 - Put the signed value in the uint64_t on the wire. The risk
    here is that some clients will assume it's a large positive
    value.

I admit I don't see the client knowing that the value is negative
instead of 0 as being a big issue for an NFS client mount and am
leaning towards #1, but I'm not familiar with what utilities
might care about the value being negative?

Anyhow, any comments? rick



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1404795089.836227.1304285111779.JavaMail.root>