Date: Tue, 8 Sep 2009 15:51:40 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r196980 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200909081551.n88Fpeta052400@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pjd Date: Tue Sep 8 15:51:40 2009 New Revision: 196980 URL: http://svn.freebsd.org/changeset/base/196980 Log: When we automatically mount snapshot we want to return vnode of the mount point from the lookup and not covered vnode. This is one of the fixes for using .zfs/ over NFS. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Tue Sep 8 15:42:55 2009 (r196979) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Tue Sep 8 15:51:40 2009 (r196980) @@ -882,9 +882,25 @@ domount: dvp->v_vfsp->mnt_stat.f_mntonname, nm); err = domount(curthread, *vpp, "zfs", mountpoint, snapname, 0); kmem_free(mountpoint, mountpoint_len); - /* FreeBSD: This line was moved from below to avoid a lock recursion. */ - if (err == 0) - vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); + if (err == 0) { + vnode_t *mvp; + + ASSERT((*vpp)->v_mountedhere != NULL); + err = VFS_ROOT((*vpp)->v_mountedhere, LK_EXCLUSIVE, &mvp); + ASSERT(err == 0); + VN_RELE(*vpp); + *vpp = mvp; + + /* + * Fix up the root vnode mounted on .zfs/snapshot/<snapname>. + * + * This is where we lie about our v_vfsp in order to + * make .zfs/snapshot/<snapname> accessible over NFS + * without requiring manual mounts of <snapname>. + */ + ASSERT(VTOZ(*vpp)->z_zfsvfs != zfsvfs); + VTOZ(*vpp)->z_zfsvfs->z_parent = zfsvfs; + } mutex_exit(&sdp->sd_lock); /* * If we had an error, drop our hold on the vnode and
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909081551.n88Fpeta052400>