Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Apr 2011 21:01:08 -0400 (EDT)
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        rmacklem@freebsd.org, fs@freebsd.org
Subject:   Re: newnfs client and statfs
Message-ID:  <149943048.820546.1304211668413.JavaMail.root@erie.cs.uoguelph.ca>
In-Reply-To: <20110430223412.GS48734@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
> I just netbooted fresh GENERIC (with irrelevant local patch) over the
> pxe, and got the following:
> 
> # df -h
> Filesystem Size Used Avail Capacity Mounted on
> 192.168.102.110:/usr/home/kostik/build/bsd/DEV/netboot/x -267G 130G
> -539G -32% /
> 
> On the server side, it is up-to-date stable/8 with oldnfs server,
> export is
> /dev/ada1p2 1.8T 129G 1.5T 8% /usr/home
> 
> Do we have some long-typed var lurking in new nfs client code,
> instead of off_t ? I am almost sure this is nfs problem, since I
> booted
> i386 in the same setup month ago, and did not had the compaints from
> sendmail about low space on spool (which is why I noted this issue
> now).
> 
> amd64 kernel (with nfscl loaded as module) correctly reports
> 192.168.102.110:/usr/home/kostik/build/bsd/DEV/netboot/x 1.8T 129G
> 1.5T 8% /
Oops, I never noticed that the "struct statfs" fields had been bumped
to 64bits. I've attached a patch for the client. Could you please test
it? (I'll look in case the server has a similar problem.)

Thanks for reporting it, rick

[-- Attachment #2 --]
--- fs/nfsclient/nfs_clport.c.sav	2011-04-30 20:16:39.000000000 -0400
+++ fs/nfsclient/nfs_clport.c	2011-04-30 20:45:16.000000000 -0400
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD: head/sys/fs/nfsclien
  * be the easiest way to handle the port.
  */
 #include <sys/hash.h>
+#include <sys/limits.h>
 #include <fs/nfs/nfsport.h>
 #include <netinet/if_ether.h>
 #include <net/if_types.h>
@@ -838,20 +839,14 @@ void
 nfscl_loadsbinfo(struct nfsmount *nmp, struct nfsstatfs *sfp, void *statfs)
 {
 	struct statfs *sbp = (struct statfs *)statfs;
-	nfsquad_t tquad;
 
 	if (nmp->nm_flag & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) {
 		sbp->f_bsize = NFS_FABLKSIZE;
-		tquad.qval = sfp->sf_tbytes;
-		sbp->f_blocks = (long)(tquad.qval / ((u_quad_t)NFS_FABLKSIZE));
-		tquad.qval = sfp->sf_fbytes;
-		sbp->f_bfree = (long)(tquad.qval / ((u_quad_t)NFS_FABLKSIZE));
-		tquad.qval = sfp->sf_abytes;
-		sbp->f_bavail = (long)(tquad.qval / ((u_quad_t)NFS_FABLKSIZE));
-		tquad.qval = sfp->sf_tfiles;
-		sbp->f_files = (tquad.lval[0] & 0x7fffffff);
-		tquad.qval = sfp->sf_ffiles;
-		sbp->f_ffree = (tquad.lval[0] & 0x7fffffff);
+		sbp->f_blocks = sfp->sf_tbytes / NFS_FABLKSIZE;
+		sbp->f_bfree = sfp->sf_fbytes / NFS_FABLKSIZE;
+		sbp->f_bavail = sfp->sf_abytes / NFS_FABLKSIZE;
+		sbp->f_files = sfp->sf_tfiles;
+		sbp->f_ffree = (sfp->sf_ffiles & OFF_MAX);
 	} else if ((nmp->nm_flag & NFSMNT_NFSV4) == 0) {
 		sbp->f_bsize = (int32_t)sfp->sf_bsize;
 		sbp->f_blocks = (int32_t)sfp->sf_blocks;

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