svn commit: r221105 - stable/8/sys/fs/nfsclient
Rick Macklem
rmacklem at FreeBSD.org
Wed Apr 27 01:45:06 UTC 2011
Author: rmacklem
Date: Wed Apr 27 01:45:05 2011
New Revision: 221105
URL: http://svn.freebsd.org/changeset/base/221105
Log:
MFC: r220610
Fix the experimental NFSv4 client so that it recognizes server
mount point crossings correctly. It was testing the wrong flag.
Also, try harder to make sure that the fsid is different than
the one assigned to the client mount point, by hashing the
server's fsid (just to create a different value deterministically)
when it is the same.
Modified:
stable/8/sys/fs/nfsclient/nfs_clport.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_clport.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clport.c Wed Apr 27 01:33:12 2011 (r221104)
+++ stable/8/sys/fs/nfsclient/nfs_clport.c Wed Apr 27 01:45:05 2011 (r221105)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
* generally, I don't like #includes inside .h files, but it seems to
* be the easiest way to handle the port.
*/
+#include <sys/hash.h>
#include <fs/nfs/nfsport.h>
#include <netinet/if_ether.h>
#include <net/if_types.h>
@@ -377,12 +378,23 @@ nfscl_loadattrcache(struct vnode **vpp,
* be the same as a local fs, but since this is in an NFS mount
* point, I don't think that will cause any problems?
*/
- if ((nmp->nm_flag & (NFSMNT_NFSV4 | NFSMNT_HASSETFSID)) ==
- (NFSMNT_NFSV4 | NFSMNT_HASSETFSID) &&
+ if (NFSHASNFSV4(nmp) && NFSHASHASSETFSID(nmp) &&
(nmp->nm_fsid[0] != np->n_vattr.na_filesid[0] ||
- nmp->nm_fsid[1] != np->n_vattr.na_filesid[1]))
- vap->va_fsid = np->n_vattr.na_filesid[0];
- else
+ nmp->nm_fsid[1] != np->n_vattr.na_filesid[1])) {
+ /*
+ * va_fsid needs to be set to some value derived from
+ * np->n_vattr.na_filesid that is not equal
+ * vp->v_mount->mnt_stat.f_fsid[0], so that it changes
+ * from the value used for the top level server volume
+ * in the mounted subtree.
+ */
+ if (vp->v_mount->mnt_stat.f_fsid.val[0] !=
+ (uint32_t)np->n_vattr.na_filesid[0])
+ vap->va_fsid = (uint32_t)np->n_vattr.na_filesid[0];
+ else
+ vap->va_fsid = (uint32_t)hash32_buf(
+ np->n_vattr.na_filesid, 2 * sizeof(uint64_t), 0);
+ } else
vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
np->n_attrstamp = time_second;
if (vap->va_size != np->n_size) {
More information about the svn-src-stable
mailing list