Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 May 2000 10:20:02 -0700 (PDT)
From:      Anatoly Vorobey <mellon@pobox.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/18874: 32bit NFS servers export wrong negative values to 64bit clients
Message-ID:  <200005291720.KAA57557@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/18874; it has been noted by GNATS.

From: Anatoly Vorobey <mellon@pobox.com>
To: alex@big.endian.de
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/18874: 32bit NFS servers export wrong negative values to 64bit clients
Date: Mon, 29 May 2000 13:14:59 -0400

 You, alex@big.endian.de, were spotted writing this on Mon, May 29, 2000 at 05:24:23PM +0200:
 > NFS Server wants to export that fs:
 > /dev/ad0s4g   2482878  2361105   -76857   103%    /usr
 > 
 > NFS client sees:
 > neutron:/usr/obj         2482878  2361105 18014398509405127     0%    /usr/obj
 
 Gotta love those signed<-->unsigned bugs ;)
 
 This seemed interesting enough for me to rummage around in sources,
 but I don't really have a working setup with Alpha NFS to test this against.
 I wonder if you could try this patch, which seems to do The Right Thing
 to me. I won't be surprised if it fails to work at all though :)
 
 A brief explanation: tquad is 64-bit unsigned, and holds the available
 bytes value which is really signed long. Suppose the real value is negative.
 If we divide it by NFS_FABLKSIZE first, and then
 cast to long, we risk turning it into a positive value by division.
 
 --- /usr/src/sys/nfs/nfs_vfsops.c	Sun Aug 29 12:30:31 1999
 +++ nfs_vfsops.c	Mon May 29 13:08:50 2000
 @@ -297,7 +297,7 @@
  		fxdr_hyper(&sfp->sf_fbytes, &tquad);
  		sbp->f_bfree = (long)(tquad / ((u_quad_t)NFS_FABLKSIZE));
  		fxdr_hyper(&sfp->sf_abytes, &tquad);
 -		sbp->f_bavail = (long)(tquad / ((u_quad_t)NFS_FABLKSIZE));
 +		sbp->f_bavail = ((long)tquad) / (long)NFS_FABLKSIZE);
  		sbp->f_files = (fxdr_unsigned(int32_t,
  		    sfp->sf_tfiles.nfsuquad[1]) & 0x7fffffff);
  		sbp->f_ffree = (fxdr_unsigned(int32_t,
 
 -- 
 Anatoly Vorobey,
 mellon@pobox.com http://pobox.com/~mellon/
 "Angels can fly because they take themselves lightly" - G.K.Chesterton
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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