Index: sys/sys/mount.h
===================================================================
RCS file: /cvsroot/src/sys/sys/mount.h,v
retrieving revision 1.214
diff -p -u -4 -r1.214 mount.h
--- sys/sys/mount.h	24 May 2014 16:34:03 -0000	1.214
+++ sys/sys/mount.h	25 Jun 2014 09:03:01 -0000
@@ -220,9 +220,9 @@ struct vfsops {
 	int	(*vfs_statvfs)	(struct mount *, struct statvfs *);
 	int	(*vfs_sync)	(struct mount *, int, struct kauth_cred *);
 	int	(*vfs_vget)	(struct mount *, ino_t, struct vnode **);
 	int	(*vfs_loadvnode) (struct mount *, struct vnode *,
-				    const void *, size_t, const void **);
+				    void *, size_t, void **);
 	int	(*vfs_fhtovp)	(struct mount *, struct fid *,
 				    struct vnode **);
 	int	(*vfs_vptofh)	(struct vnode *, struct fid *, size_t *);
 	void	(*vfs_init)	(void);
@@ -285,9 +285,9 @@ int	fsname##_quotactl(struct mount *, st
 int	fsname##_statvfs(struct mount *, struct statvfs *);		\
 int	fsname##_sync(struct mount *, int, struct kauth_cred *);	\
 int	fsname##_vget(struct mount *, ino_t, struct vnode **);		\
 int	fsname##_loadvnode(struct mount *, struct vnode *,		\
-		const void *, size_t, const void **);			\
+		void *, size_t, void **);			\
 int	fsname##_fhtovp(struct mount *, struct fid *, struct vnode **);	\
 int	fsname##_vptofh(struct vnode *, struct fid *, size_t *);	\
 void	fsname##_init(void);						\
 void	fsname##_reinit(void);						\
Index: sys/sys/vnode.h
===================================================================
RCS file: /cvsroot/src/sys/sys/vnode.h,v
retrieving revision 1.248
diff -p -u -4 -r1.248 vnode.h
--- sys/sys/vnode.h	25 May 2014 13:51:26 -0000	1.248
+++ sys/sys/vnode.h	25 Jun 2014 09:03:01 -0000
@@ -555,10 +555,11 @@ void	vrevoke(struct vnode *);
 struct vnode *
 	vnalloc(struct mount *);
 void	vnfree(struct vnode *);
 void	vremfree(struct vnode *);
-int	vcache_get(struct mount *, const void *, size_t, struct vnode **);
-void	vcache_remove(struct mount *, const void *, size_t);
+int	vcache_get(struct mount *, void *, size_t, struct vnode **);
+void	vcache_rekey(struct mount *, void *, size_t, void *, size_t);
+void	vcache_remove(struct mount *, void *, size_t);
 
 /* see vnsubr(9) */
 int	vn_bwrite(void *);
 int 	vn_close(struct vnode *, int, kauth_cred_t);
Index: sys/kern/vfs_vnode.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_vnode.c,v
retrieving revision 1.36
diff -p -u -4 -r1.36 vfs_vnode.c
--- sys/kern/vfs_vnode.c	8 May 2014 08:21:53 -0000	1.36
+++ sys/kern/vfs_vnode.c	25 Jun 2014 09:02:57 -0000
@@ -149,9 +149,9 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,
 #define	VRELEL_CHANGING_SET	0x0002	/* VI_CHANGING set by caller. */
 
 struct vcache_key {
 	struct mount *vk_mount;
-	const void *vk_key;
+	void *vk_key;
 	size_t vk_key_len;
 };
 struct vcache_node {
 	SLIST_ENTRY(vcache_node) vn_hash;
@@ -1145,9 +1145,9 @@ vgone(vnode_t *vp)
 	vrelel(vp, VRELEL_CHANGING_SET);
 }
 
 static inline uint32_t
-vcache_hash(const struct vcache_key *key)
+vcache_hash(struct vcache_key *key)
 {
 	uint32_t hash = HASH32_BUF_INIT;
 
 	hash = hash32_buf(&key->vk_mount, sizeof(struct mount *), hash);
@@ -1194,9 +1194,9 @@ vcache_reinit(void)
 	hashdone(oldtab, HASH_SLIST, oldmask);
 }
 
 static inline struct vcache_node *
-vcache_hash_lookup(const struct vcache_key *key, uint32_t hash)
+vcache_hash_lookup(struct vcache_key *key, uint32_t hash)
 {
 	struct hashhead *hashp;
 	struct vcache_node *node;
 
@@ -1218,14 +1218,13 @@ vcache_hash_lookup(const struct vcache_k
 /*
  * Get a vnode / fs node pair by key and return it referenced through vpp.
  */
 int
-vcache_get(struct mount *mp, const void *key, size_t key_len,
-    struct vnode **vpp)
+vcache_get(struct mount *mp, void *key, size_t key_len, struct vnode **vpp)
 {
 	int error;
 	uint32_t hash;
-	const void *new_key;
+	void *new_key;
 	struct vnode *vp;
 	struct vcache_key vcache_key;
 	struct vcache_node *node, *new_node;
 
@@ -1323,12 +1322,46 @@ again:
 	return 0;
 }
 
 /*
+ * Change the key of a cached vnode / fs node pair.
+ */
+void
+vcache_rekey(struct mount *mp, void *old_key, size_t old_key_len,
+    void *new_key, size_t new_key_len)
+{
+	uint32_t old_hash, new_hash;
+	struct vcache_key old_vcache_key, new_vcache_key;
+	struct vcache_node *node;
+
+	old_vcache_key.vk_mount = mp;
+	old_vcache_key.vk_key = old_key;
+	old_vcache_key.vk_key_len = old_key_len;
+	old_hash = vcache_hash(&old_vcache_key);
+
+	new_vcache_key.vk_mount = mp;
+	new_vcache_key.vk_key = new_key;
+	new_vcache_key.vk_key_len = new_key_len;
+	new_hash = vcache_hash(&new_vcache_key);
+
+	mutex_enter(&vcache.lock);
+	node = vcache_hash_lookup(&old_vcache_key, old_hash);
+	KASSERT(node != NULL);
+	KASSERT(vcache_hash_lookup(&new_vcache_key, new_hash) == NULL);
+	SLIST_REMOVE(&vcache.hashtab[old_hash & vcache.hashmask],
+	    node, vcache_node, vn_hash);
+	node->vn_key.vk_key_len = new_key_len;
+	memcpy(node->vn_key.vk_key, new_key, new_key_len);
+	SLIST_INSERT_HEAD(&vcache.hashtab[new_hash & vcache.hashmask],
+	    node, vn_hash);
+	mutex_exit(&vcache.lock);
+}
+
+/*
  * Remove a vnode / fs node pair from the cache.
  */
 void
-vcache_remove(struct mount *mp, const void *key, size_t key_len)
+vcache_remove(struct mount *mp, void *key, size_t key_len)
 {
 	uint32_t hash;
 	struct vcache_key vcache_key;
 	struct vcache_node *node;
Index: sys/fs/cd9660/cd9660_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/fs/cd9660/cd9660_vfsops.c,v
retrieving revision 1.88
diff -p -u -4 -r1.88 cd9660_vfsops.c
--- sys/fs/cd9660/cd9660_vfsops.c	22 Jun 2014 09:47:40 -0000	1.88
+++ sys/fs/cd9660/cd9660_vfsops.c	25 Jun 2014 09:02:57 -0000
@@ -693,9 +693,9 @@ cd9660_vget(struct mount *mp, ino_t ino,
 }
 
 int
 cd9660_loadvnode(struct mount *mp, struct vnode *vp,
-    const void *key, size_t key_len, const void **new_key)
+    void *key, size_t key_len, void **new_key)
 {
 	struct iso_mnt *imp;
 	struct iso_node *ip;
 	struct iso_directory_record *isodir;
Index: sys/miscfs/genfs/layer_extern.h
===================================================================
RCS file: /cvsroot/src/sys/miscfs/genfs/layer_extern.h,v
retrieving revision 1.36
diff -p -u -4 -r1.36 layer_extern.h
--- sys/miscfs/genfs/layer_extern.h	25 May 2014 13:51:25 -0000	1.36
+++ sys/miscfs/genfs/layer_extern.h	25 Jun 2014 09:02:57 -0000
@@ -84,9 +84,9 @@ int	layerfs_root(struct mount *, struct 
 int	layerfs_quotactl(struct mount *, struct quotactl_args *);
 int	layerfs_statvfs(struct mount *, struct statvfs *);
 int	layerfs_sync(struct mount *, int, struct kauth_cred *);
 int	layerfs_loadvnode(struct mount *,  struct vnode *,
-	    const void *, size_t, const void **);
+	    void *, size_t, void **);
 int	layerfs_vget(struct mount *, ino_t, struct vnode **);
 int	layerfs_fhtovp(struct mount *, struct fid *, struct vnode **);
 int	layerfs_vptofh(struct vnode *, struct fid *, size_t *);
 int	layerfs_snapshot(struct mount *, struct vnode *, struct timespec *);
Index: sys/miscfs/genfs/layer_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/miscfs/genfs/layer_vfsops.c,v
retrieving revision 1.44
diff -p -u -4 -r1.44 layer_vfsops.c
--- sys/miscfs/genfs/layer_vfsops.c	25 May 2014 13:51:25 -0000	1.44
+++ sys/miscfs/genfs/layer_vfsops.c	25 Jun 2014 09:02:57 -0000
@@ -205,9 +205,9 @@ layerfs_sync(struct mount *mp, int waitf
 }
 
 int
 layerfs_loadvnode(struct mount *mp, struct vnode *vp,
-    const void *key, size_t key_len, const void **new_key)
+    void *key, size_t key_len, void **new_key)
 {
 	struct layer_mount *lmp = MOUNTTOLAYERMOUNT(mp);
 	struct vnode *lowervp;
 	struct layer_node *xp;
Index: sys/nfs/nfs_node.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_node.c,v
retrieving revision 1.118
diff -p -u -4 -r1.118 nfs_node.c
--- sys/nfs/nfs_node.c	30 May 2014 08:47:45 -0000	1.118
+++ sys/nfs/nfs_node.c	25 Jun 2014 09:03:00 -0000
@@ -111,9 +111,9 @@ nfs_node_done(void)
  * Caller assures no other thread will try to load this node.
  */
 int
 nfs_loadvnode(struct mount *mp, struct vnode *vp,
-    const void *key, size_t key_len, const void **new_key)
+    void *key, size_t key_len, void **new_key)
 {
 	int fhsize = key_len;
 	const nfsfh_t *fhp = key;
 	struct nfsnode *np;
Index: sys/ufs/ext2fs/ext2fs_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ext2fs/ext2fs_vfsops.c,v
retrieving revision 1.182
diff -p -u -4 -r1.182 ext2fs_vfsops.c
--- sys/ufs/ext2fs/ext2fs_vfsops.c	24 May 2014 16:34:04 -0000	1.182
+++ sys/ufs/ext2fs/ext2fs_vfsops.c	25 Jun 2014 09:03:02 -0000
@@ -953,9 +953,9 @@ ext2fs_sync(struct mount *mp, int waitfo
  * Caller assures no other thread will try to load this inode.
  */
 int
 ext2fs_loadvnode(struct mount *mp, struct vnode *vp,
-    const void *key, size_t key_len, const void **new_key)
+    void *key, size_t key_len, void **new_key)
 {
 	ino_t ino;
 	struct m_ext2fs *fs;
 	struct inode *ip;
Index: sys/ufs/ffs/ffs_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ffs/ffs_vfsops.c,v
retrieving revision 1.299
diff -p -u -4 -r1.299 ffs_vfsops.c
--- sys/ufs/ffs/ffs_vfsops.c	24 May 2014 16:34:04 -0000	1.299
+++ sys/ufs/ffs/ffs_vfsops.c	25 Jun 2014 09:03:02 -0000
@@ -1744,9 +1744,9 @@ ffs_sync(struct mount *mp, int waitfor, 
  * Caller assures no other thread will try to load this inode.
  */
 int
 ffs_loadvnode(struct mount *mp, struct vnode *vp,
-    const void *key, size_t key_len, const void **new_key)
+    void *key, size_t key_len, void **new_key)
 {
 	ino_t ino;
 	struct fs *fs;
 	struct inode *ip;
