From owner-svn-src-stable@FreeBSD.ORG Wed Apr 27 01:45:06 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB01B106564A; Wed, 27 Apr 2011 01:45:05 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B94308FC20; Wed, 27 Apr 2011 01:45:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3R1j5LA048005; Wed, 27 Apr 2011 01:45:05 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3R1j5c7048004; Wed, 27 Apr 2011 01:45:05 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201104270145.p3R1j5c7048004@svn.freebsd.org> From: Rick Macklem Date: Wed, 27 Apr 2011 01:45:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221105 - stable/8/sys/fs/nfsclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2011 01:45:06 -0000 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 #include #include #include @@ -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) {