Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Apr 2011 19:34:58 +0000 (UTC)
From:      Zack Kirsch <zack@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r220607 - stable/8/sys/fs/nfsclient
Message-ID:  <201104131934.p3DJYwcA009358@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zack
Date: Wed Apr 13 19:34:58 2011
New Revision: 220607
URL: http://svn.freebsd.org/changeset/base/220607

Log:
  MFC: 220152
    This patch fixes the Experimental NFS client to properly deal with 32 bit or
    64 bit fileid's in NFSv2 and NFSv3. Without this fix, invalid casting (and sign
    extension) was creating problems for any fileid greater than 2^31.
  
    We discovered this because we have test clusters with more than 2 billion
    allocated files and 64-bit ino_t's (and friend structures).
  
  Reviewed by:    rmacklem
  Approved by:    zml (mentor)

Modified:
  stable/8/sys/fs/nfsclient/nfs_clcomsubs.c
  stable/8/sys/fs/nfsclient/nfs_clrpcops.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/nfsclient/nfs_clcomsubs.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clcomsubs.c	Wed Apr 13 19:10:56 2011	(r220606)
+++ stable/8/sys/fs/nfsclient/nfs_clcomsubs.c	Wed Apr 13 19:34:58 2011	(r220607)
@@ -289,8 +289,7 @@ nfsm_loadattr(struct nfsrv_descript *nd,
 		nap->na_size = fxdr_hyper(&fp->fa3_size);
 		nap->na_blocksize = NFS_FABLKSIZE;
 		nap->na_bytes = fxdr_hyper(&fp->fa3_used);
-		nap->na_fileid = fxdr_unsigned(int32_t,
-		    fp->fa3_fileid.nfsuquad[1]);
+		nap->na_fileid = fxdr_hyper(&fp->fa3_fileid);
 		fxdr_nfsv3time(&fp->fa3_atime, &nap->na_atime);
 		fxdr_nfsv3time(&fp->fa3_ctime, &nap->na_ctime);
 		fxdr_nfsv3time(&fp->fa3_mtime, &nap->na_mtime);
@@ -317,7 +316,7 @@ nfsm_loadattr(struct nfsrv_descript *nd,
 		nap->na_bytes =
 		    (u_quad_t)fxdr_unsigned(int32_t, fp->fa2_blocks) *
 		    NFS_FABLKSIZE;
-		nap->na_fileid = fxdr_unsigned(int32_t, fp->fa2_fileid);
+		nap->na_fileid = fxdr_unsigned(uint64_t, fp->fa2_fileid);
 		fxdr_nfsv2time(&fp->fa2_atime, &nap->na_atime);
 		fxdr_nfsv2time(&fp->fa2_mtime, &nap->na_mtime);
 		nap->na_flags = 0;

Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Wed Apr 13 19:10:56 2011	(r220606)
+++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Wed Apr 13 19:34:58 2011	(r220607)
@@ -2745,9 +2745,9 @@ nfsrpc_readdir(vnode_t vp, struct uio *u
 				len = fxdr_unsigned(int, *tl);
 			} else if (nd->nd_flag & ND_NFSV3) {
 				NFSM_DISSECT(tl, u_int32_t *, 3*NFSX_UNSIGNED);
-				nfsva.na_fileid =
-				    fxdr_unsigned(long, *++tl);
-				len = fxdr_unsigned(int, *++tl);
+				nfsva.na_fileid = fxdr_hyper(tl);
+				tl += 2;
+				len = fxdr_unsigned(int, *tl);
 			} else {
 				NFSM_DISSECT(tl, u_int32_t *, 2*NFSX_UNSIGNED);
 				nfsva.na_fileid =



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