summaryrefslogtreecommitdiffstats
path: root/sys/fs/nfsclient
diff options
context:
space:
mode:
authorzack <zack@FreeBSD.org>2011-03-30 01:10:11 +0000
committerzack <zack@FreeBSD.org>2011-03-30 01:10:11 +0000
commita9eba0596c4e413de61c0d0960d01c83a16b0feb (patch)
tree15a55d3d14e6727a042fb8b2e8db41dd19854ed4 /sys/fs/nfsclient
parent24a0f968ca05de3f4d12a803e9141af94f6d0aee (diff)
downloadFreeBSD-src-a9eba0596c4e413de61c0d0960d01c83a16b0feb.zip
FreeBSD-src-a9eba0596c4e413de61c0d0960d01c83a16b0feb.tar.gz
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
Diffstat (limited to 'sys/fs/nfsclient')
-rw-r--r--sys/fs/nfsclient/nfs_clcomsubs.c5
-rw-r--r--sys/fs/nfsclient/nfs_clrpcops.c6
2 files changed, 5 insertions, 6 deletions
diff --git a/sys/fs/nfsclient/nfs_clcomsubs.c b/sys/fs/nfsclient/nfs_clcomsubs.c
index b0bc3c3..6866a73 100644
--- a/sys/fs/nfsclient/nfs_clcomsubs.c
+++ b/sys/fs/nfsclient/nfs_clcomsubs.c
@@ -289,8 +289,7 @@ nfsm_loadattr(struct nfsrv_descript *nd, struct nfsvattr *nap)
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, struct nfsvattr *nap)
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;
diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index 2512ad4..37e1b81 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -2738,9 +2738,9 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
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 =
OpenPOWER on IntegriCloud