Date: Wed, 13 Apr 2011 22:16:52 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r220610 - head/sys/fs/nfsclient Message-ID: <201104132216.p3DMGqpi012980@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Wed Apr 13 22:16:52 2011 New Revision: 220610 URL: http://svn.freebsd.org/changeset/base/220610 Log: 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. MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clport.c Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Wed Apr 13 19:55:58 2011 (r220609) +++ head/sys/fs/nfsclient/nfs_clport.c Wed Apr 13 22:16:52 2011 (r220610) @@ -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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104132216.p3DMGqpi012980>