From owner-svn-src-all@FreeBSD.ORG Wed Apr 13 22:16:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF90E106566B; Wed, 13 Apr 2011 22:16:52 +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 94CEC8FC0A; Wed, 13 Apr 2011 22:16:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3DMGqND012982; Wed, 13 Apr 2011 22:16:52 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3DMGqpi012980; Wed, 13 Apr 2011 22:16:52 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201104132216.p3DMGqpi012980@svn.freebsd.org> From: Rick Macklem Date: Wed, 13 Apr 2011 22:16:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220610 - head/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Apr 2011 22:16:52 -0000 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 #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) {