Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jul 2014 14:24:18 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r269189 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201407281424.s6SEOILA088203@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Jul 28 14:24:18 2014
New Revision: 269189
URL: http://svnweb.freebsd.org/changeset/base/269189

Log:
  Initialize zfs vnode v_hash when the vnode is allocated, instead of
  postponing it to zfs_vget().  zfs_root() returned vnode with the
  default value of v_hash, which caused inconsistent v_hash value when
  root vnode was obtained from zfs_vget().
  
  Nullfs allocated two upper vnodes for the root zfs vnode due to
  different hashes, causing consistency problems.
  
  Reported and tested by:	Harald Schmalzbauer <h.schmalzbauer@omnilan.de>
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c	Mon Jul 28 14:22:34 2014	(r269188)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c	Mon Jul 28 14:24:18 2014	(r269189)
@@ -2075,8 +2075,6 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int fla
 		err = vn_lock(*vpp, flags);
 	if (err != 0)
 		*vpp = NULL;
-	else
-		(*vpp)->v_hash = ino;
 	return (err);
 }
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c	Mon Jul 28 14:22:34 2014	(r269188)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c	Mon Jul 28 14:24:18 2014	(r269189)
@@ -1228,9 +1228,10 @@ again:
 		vnode_t *vp = ZTOV(zp);
 
 		err = insmntque(vp, zfsvfs->z_vfs);
-		if (err == 0)
+		if (err == 0) {
+			vp->v_hash = obj_num;
 			VOP_UNLOCK(vp, 0);
-		else {
+		} else {
 			zp->z_vnode = NULL;
 			zfs_znode_dmu_fini(zp);
 			zfs_znode_free(zp);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407281424.s6SEOILA088203>