Workaround NFS bug with readdirplus when there are greater than 1 billion files in a filesystem.

Reviewed by	kib
MFC after:	2 weeks
Sponsored by:	iXsystems
Differential Revision:	D9009
This commit is contained in:
Josh Paetzel 2017-01-02 19:18:56 +00:00
parent 474da3c328
commit b5a8f340f1

View File

@ -2018,25 +2018,17 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram,
} }
/* /*
* Check to see if entries in this directory can be safely acquired * For now ZFS requires VOP_LOOKUP as a workaround. Until ino_t is changed
* via VFS_VGET() or if a switch to VOP_LOOKUP() is required. * to 64 bit type a ZFS filesystem with over 1 billion files in it
* ZFS snapshot directories need VOP_LOOKUP(), so that any * will suffer from 64bit -> 32bit truncation.
* automount of the snapshot directory that is required will
* be done.
* This needs to be done here for NFSv4, since NFSv4 never does
* a VFS_VGET() for "." or "..".
*/ */
if (is_zfs == 1) { if (is_zfs == 1)
r = VFS_VGET(mp, at.na_fileid, LK_SHARED, &nvp); usevget = 0;
if (r == EOPNOTSUPP) {
usevget = 0; cn.cn_nameiop = LOOKUP;
cn.cn_nameiop = LOOKUP; cn.cn_lkflags = LK_SHARED | LK_RETRY;
cn.cn_lkflags = LK_SHARED | LK_RETRY; cn.cn_cred = nd->nd_cred;
cn.cn_cred = nd->nd_cred; cn.cn_thread = p;
cn.cn_thread = p;
} else if (r == 0)
vput(nvp);
}
/* /*
* Save this position, in case there is an error before one entry * Save this position, in case there is an error before one entry
@ -2105,16 +2097,7 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram,
else else
r = EOPNOTSUPP; r = EOPNOTSUPP;
if (r == EOPNOTSUPP) { if (r == EOPNOTSUPP) {
if (usevget) { usevget = 0;
usevget = 0;
cn.cn_nameiop = LOOKUP;
cn.cn_lkflags =
LK_SHARED |
LK_RETRY;
cn.cn_cred =
nd->nd_cred;
cn.cn_thread = p;
}
cn.cn_nameptr = dp->d_name; cn.cn_nameptr = dp->d_name;
cn.cn_namelen = nlen; cn.cn_namelen = nlen;
cn.cn_flags = ISLASTCN | cn.cn_flags = ISLASTCN |