Fix the NFS client/server so that it actually uses the 64bit ino_t filenos.
The code still doesn't use d_off. That will come in a future commit. The code also removes the checks for servers returning a fileno that doesn't fit in 32bits, since that should work ok now. Bump __FreeBSD_version since this patch changes the interface between the NFS kernel modules. Reviewed by: kib
This commit is contained in:
parent
4558167c59
commit
95ac7f1a74
@ -265,7 +265,7 @@ struct nfsreferral {
|
||||
u_char *nfr_srvlist; /* List of servers */
|
||||
int nfr_srvcnt; /* number of servers */
|
||||
vnode_t nfr_vp; /* vnode for referral */
|
||||
u_int32_t nfr_dfileno; /* assigned dir inode# */
|
||||
uint64_t nfr_dfileno; /* assigned dir inode# */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -348,7 +348,7 @@ nfsvno_pathconf(struct vnode *vp, int flag, register_t *retf,
|
||||
|
||||
/* Fake nfsrv_atroot. Just return 0 */
|
||||
int
|
||||
nfsrv_atroot(struct vnode *vp, long *retp)
|
||||
nfsrv_atroot(struct vnode *vp, uint64_t *retp)
|
||||
{
|
||||
|
||||
return (0);
|
||||
|
@ -820,19 +820,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp,
|
||||
struct timespec temptime;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
long fid;
|
||||
u_int32_t freenum = 0, tuint;
|
||||
u_int64_t uquad = 0, thyp, thyp2;
|
||||
#ifdef QUOTA
|
||||
struct dqblk dqb;
|
||||
uid_t savuid;
|
||||
#endif
|
||||
static struct timeval last64fileid;
|
||||
static size_t count64fileid;
|
||||
static struct timeval last64mountfileid;
|
||||
static size_t count64mountfileid;
|
||||
static struct timeval warninterval = { 60, 0 };
|
||||
|
||||
CTASSERT(sizeof(ino_t) == sizeof(uint64_t));
|
||||
if (compare) {
|
||||
retnotsup = 0;
|
||||
error = nfsrv_getattrbits(nd, &attrbits, NULL, &retnotsup);
|
||||
@ -1212,20 +1207,11 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp,
|
||||
thyp = fxdr_hyper(tl);
|
||||
if (compare) {
|
||||
if (!(*retcmpp)) {
|
||||
if ((u_int64_t)nap->na_fileid != thyp)
|
||||
*retcmpp = NFSERR_NOTSAME;
|
||||
}
|
||||
} else if (nap != NULL) {
|
||||
if (*tl++) {
|
||||
count64fileid++;
|
||||
if (ratecheck(&last64fileid, &warninterval)) {
|
||||
printf("NFSv4 fileid > 32bits (%zu occurrences)\n",
|
||||
count64fileid);
|
||||
count64fileid = 0;
|
||||
}
|
||||
if (nap->na_fileid != thyp)
|
||||
*retcmpp = NFSERR_NOTSAME;
|
||||
}
|
||||
} else if (nap != NULL)
|
||||
nap->na_fileid = thyp;
|
||||
}
|
||||
attrsum += NFSX_HYPER;
|
||||
break;
|
||||
case NFSATTRBIT_FILESAVAIL:
|
||||
@ -1749,27 +1735,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp,
|
||||
NFSM_DISSECT(tl, u_int32_t *, NFSX_HYPER);
|
||||
thyp = fxdr_hyper(tl);
|
||||
if (compare) {
|
||||
if (!(*retcmpp)) {
|
||||
if (*tl++) {
|
||||
*retcmpp = NFSERR_NOTSAME;
|
||||
} else {
|
||||
if (!vp || !nfsrv_atroot(vp, &fid))
|
||||
fid = nap->na_fileid;
|
||||
if ((u_int64_t)fid != thyp)
|
||||
if (!(*retcmpp)) {
|
||||
if (!vp || !nfsrv_atroot(vp, &thyp2))
|
||||
thyp2 = nap->na_fileid;
|
||||
if (thyp2 != thyp)
|
||||
*retcmpp = NFSERR_NOTSAME;
|
||||
}
|
||||
}
|
||||
} else if (nap != NULL) {
|
||||
if (*tl++) {
|
||||
count64mountfileid++;
|
||||
if (ratecheck(&last64mountfileid, &warninterval)) {
|
||||
printf("NFSv4 mounted on fileid > 32bits (%zu occurrences)\n",
|
||||
count64mountfileid);
|
||||
count64mountfileid = 0;
|
||||
}
|
||||
}
|
||||
nap->na_mntonfileno = thyp;
|
||||
}
|
||||
} else if (nap != NULL)
|
||||
nap->na_mntonfileno = thyp;
|
||||
attrsum += NFSX_HYPER;
|
||||
break;
|
||||
case NFSATTRBIT_SUPPATTREXCLCREAT:
|
||||
@ -2259,8 +2232,8 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp,
|
||||
break;
|
||||
case NFSATTRBIT_FILEID:
|
||||
NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER);
|
||||
*tl++ = 0;
|
||||
*tl = txdr_unsigned(vap->va_fileid);
|
||||
uquad = vap->va_fileid;
|
||||
txdr_hyper(uquad, tl);
|
||||
retnum += NFSX_HYPER;
|
||||
break;
|
||||
case NFSATTRBIT_FILESAVAIL:
|
||||
@ -2525,7 +2498,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp,
|
||||
if (at_root != 0)
|
||||
uquad = mounted_on_fileno;
|
||||
else
|
||||
uquad = (u_int64_t)vap->va_fileid;
|
||||
uquad = vap->va_fileid;
|
||||
txdr_hyper(uquad, tl);
|
||||
retnum += NFSX_HYPER;
|
||||
break;
|
||||
|
@ -370,7 +370,7 @@ int nfs_catnap(int, int, const char *);
|
||||
struct nfsreferral *nfsv4root_getreferral(vnode_t, vnode_t, u_int32_t);
|
||||
int nfsvno_pathconf(vnode_t, int, register_t *, struct ucred *,
|
||||
NFSPROC_T *);
|
||||
int nfsrv_atroot(vnode_t, long *);
|
||||
int nfsrv_atroot(vnode_t, uint64_t *);
|
||||
void newnfs_timer(void *);
|
||||
int nfs_supportsnfsv4acls(vnode_t);
|
||||
|
||||
|
@ -518,7 +518,7 @@ struct nfs_vattr {
|
||||
struct nfsvattr {
|
||||
struct vattr na_vattr;
|
||||
nfsattrbit_t na_suppattr;
|
||||
u_int32_t na_mntonfileno;
|
||||
u_int64_t na_mntonfileno;
|
||||
u_int64_t na_filesid[2];
|
||||
};
|
||||
|
||||
|
@ -2742,11 +2742,10 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
|
||||
struct nfsrv_descript nfsd, *nd = &nfsd;
|
||||
int error = 0, tlen, more_dirs = 1, blksiz = 0, bigenough = 1;
|
||||
int reqsize, tryformoredirs = 1, readsize, eof = 0, gotmnton = 0;
|
||||
long dotfileid, dotdotfileid = 0;
|
||||
u_int32_t fakefileno = 0xffffffff, rderr;
|
||||
u_int64_t dotfileid, dotdotfileid = 0, fakefileno = UINT64_MAX;
|
||||
char *cp;
|
||||
nfsattrbit_t attrbits, dattrbits;
|
||||
u_int32_t *tl2 = NULL;
|
||||
u_int32_t rderr, *tl2 = NULL;
|
||||
size_t tresid;
|
||||
|
||||
KASSERT(uiop->uio_iovcnt == 1 &&
|
||||
@ -2823,14 +2822,14 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
|
||||
error = EPERM;
|
||||
if (!error) {
|
||||
NFSM_DISSECT(tl, u_int32_t *, 2*NFSX_UNSIGNED);
|
||||
nfsva.na_mntonfileno = 0xffffffff;
|
||||
nfsva.na_mntonfileno = UINT64_MAX;
|
||||
error = nfsv4_loadattr(nd, NULL, &nfsva, NULL,
|
||||
NULL, 0, NULL, NULL, NULL, NULL, NULL, 0,
|
||||
NULL, NULL, NULL, p, cred);
|
||||
if (error) {
|
||||
dotdotfileid = dotfileid;
|
||||
} else if (gotmnton) {
|
||||
if (nfsva.na_mntonfileno != 0xffffffff)
|
||||
if (nfsva.na_mntonfileno != UINT64_MAX)
|
||||
dotdotfileid = nfsva.na_mntonfileno;
|
||||
else
|
||||
dotdotfileid = nfsva.na_fileid;
|
||||
@ -2981,8 +2980,8 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
|
||||
len = fxdr_unsigned(int, *tl);
|
||||
} else {
|
||||
NFSM_DISSECT(tl, u_int32_t *, 2*NFSX_UNSIGNED);
|
||||
nfsva.na_fileid =
|
||||
fxdr_unsigned(long, *tl++);
|
||||
nfsva.na_fileid = fxdr_unsigned(uint64_t,
|
||||
*tl++);
|
||||
len = fxdr_unsigned(int, *tl);
|
||||
}
|
||||
if (len <= 0 || len > NFS_MAXNAMLEN) {
|
||||
@ -3037,7 +3036,7 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
|
||||
}
|
||||
if (nd->nd_flag & ND_NFSV4) {
|
||||
rderr = 0;
|
||||
nfsva.na_mntonfileno = 0xffffffff;
|
||||
nfsva.na_mntonfileno = UINT64_MAX;
|
||||
error = nfsv4_loadattr(nd, NULL, &nfsva, NULL,
|
||||
NULL, 0, NULL, NULL, NULL, NULL, NULL, 0,
|
||||
NULL, NULL, &rderr, p, cred);
|
||||
@ -3059,7 +3058,7 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
|
||||
dp->d_fileno = 0;
|
||||
} else {
|
||||
if (gotmnton) {
|
||||
if (nfsva.na_mntonfileno != 0xffffffff)
|
||||
if (nfsva.na_mntonfileno != UINT64_MAX)
|
||||
dp->d_fileno = nfsva.na_mntonfileno;
|
||||
else
|
||||
dp->d_fileno = nfsva.na_fileid;
|
||||
@ -3184,11 +3183,12 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
|
||||
int error = 0, tlen, more_dirs = 1, blksiz = 0, bigenough = 1;
|
||||
int attrflag, tryformoredirs = 1, eof = 0, gotmnton = 0;
|
||||
int isdotdot = 0, unlocknewvp = 0;
|
||||
long dotfileid, dotdotfileid = 0, fileno = 0;
|
||||
u_int64_t dotfileid, dotdotfileid = 0, fakefileno = UINT64_MAX;
|
||||
u_int64_t fileno = 0;
|
||||
char *cp;
|
||||
nfsattrbit_t attrbits, dattrbits;
|
||||
size_t tresid;
|
||||
u_int32_t *tl2 = NULL, fakefileno = 0xffffffff, rderr;
|
||||
u_int32_t *tl2 = NULL, rderr;
|
||||
struct timespec dctime;
|
||||
|
||||
KASSERT(uiop->uio_iovcnt == 1 &&
|
||||
@ -3255,14 +3255,14 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
|
||||
error = EPERM;
|
||||
if (!error) {
|
||||
NFSM_DISSECT(tl, u_int32_t *, 2*NFSX_UNSIGNED);
|
||||
nfsva.na_mntonfileno = 0xffffffff;
|
||||
nfsva.na_mntonfileno = UINT64_MAX;
|
||||
error = nfsv4_loadattr(nd, NULL, &nfsva, NULL,
|
||||
NULL, 0, NULL, NULL, NULL, NULL, NULL, 0,
|
||||
NULL, NULL, NULL, p, cred);
|
||||
if (error) {
|
||||
dotdotfileid = dotfileid;
|
||||
} else if (gotmnton) {
|
||||
if (nfsva.na_mntonfileno != 0xffffffff)
|
||||
if (nfsva.na_mntonfileno != UINT64_MAX)
|
||||
dotdotfileid = nfsva.na_mntonfileno;
|
||||
else
|
||||
dotdotfileid = nfsva.na_fileid;
|
||||
@ -3394,8 +3394,8 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
|
||||
ncookie.lval[0] = *tl++;
|
||||
ncookie.lval[1] = *tl++;
|
||||
} else {
|
||||
fileno = fxdr_unsigned(long, *++tl);
|
||||
tl++;
|
||||
fileno = fxdr_hyper(tl);
|
||||
tl += 2;
|
||||
}
|
||||
len = fxdr_unsigned(int, *tl);
|
||||
if (len <= 0 || len > NFS_MAXNAMLEN) {
|
||||
|
@ -1398,8 +1398,7 @@ nfsrv_fillattr(struct nfsrv_descript *nd, struct nfsvattr *nvap)
|
||||
fp->fa3_rdev.specdata2 = txdr_unsigned(NFSMINOR(nvap->na_rdev));
|
||||
fp->fa3_fsid.nfsuquad[0] = 0;
|
||||
fp->fa3_fsid.nfsuquad[1] = txdr_unsigned(nvap->na_fsid);
|
||||
fp->fa3_fileid.nfsuquad[0] = 0;
|
||||
fp->fa3_fileid.nfsuquad[1] = txdr_unsigned(nvap->na_fileid);
|
||||
txdr_hyper(nvap->na_fileid, &fp->fa3_fileid);
|
||||
txdr_nfsv3time(&nvap->na_atime, &fp->fa3_atime);
|
||||
txdr_nfsv3time(&nvap->na_mtime, &fp->fa3_mtime);
|
||||
txdr_nfsv3time(&nvap->na_ctime, &fp->fa3_ctime);
|
||||
@ -1809,8 +1808,7 @@ nfsrv_putreferralattr(struct nfsrv_descript *nd, nfsattrbit_t *retbitp,
|
||||
break;
|
||||
case NFSATTRBIT_MOUNTEDONFILEID:
|
||||
NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER);
|
||||
*tl++ = 0;
|
||||
*tl = txdr_unsigned(refp->nfr_dfileno);
|
||||
txdr_hyper(refp->nfr_dfileno, tl);
|
||||
retnum += NFSX_HYPER;
|
||||
break;
|
||||
default:
|
||||
|
@ -58,7 +58,7 @@
|
||||
* in the range 5 to 9.
|
||||
*/
|
||||
#undef __FreeBSD_version
|
||||
#define __FreeBSD_version 1200033 /* Master, propagated to newvers */
|
||||
#define __FreeBSD_version 1200034 /* Master, propagated to newvers */
|
||||
|
||||
/*
|
||||
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
|
||||
|
Loading…
x
Reference in New Issue
Block a user