From owner-svn-src-all@FreeBSD.ORG Wed Mar 30 01:10:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F9BA1065670; Wed, 30 Mar 2011 01:10:12 +0000 (UTC) (envelope-from zack@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8EE48FC0C; Wed, 30 Mar 2011 01:10:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2U1ABTK046033; Wed, 30 Mar 2011 01:10:11 GMT (envelope-from zack@svn.freebsd.org) Received: (from zack@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2U1ABB1046030; Wed, 30 Mar 2011 01:10:11 GMT (envelope-from zack@svn.freebsd.org) Message-Id: <201103300110.p2U1ABB1046030@svn.freebsd.org> From: Zack Kirsch Date: Wed, 30 Mar 2011 01:10:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220152 - head/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Mar 2011 01:10:12 -0000 Author: zack Date: Wed Mar 30 01:10:11 2011 New Revision: 220152 URL: http://svn.freebsd.org/changeset/base/220152 Log: 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) MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c head/sys/fs/nfsclient/nfs_clrpcops.c Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clcomsubs.c Tue Mar 29 20:58:25 2011 (r220151) +++ head/sys/fs/nfsclient/nfs_clcomsubs.c Wed Mar 30 01:10:11 2011 (r220152) @@ -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: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Tue Mar 29 20:58:25 2011 (r220151) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Wed Mar 30 01:10:11 2011 (r220152) @@ -2738,9 +2738,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 =