On 26 Jun 2014, at 05:33, David Holland <dholland-tech%netbsd.org@localhost> wrote: > On Wed, Jun 25, 2014 at 09:46:16AM +0000, Taylor R Campbell wrote: >> Also, I wonder whether any file systems will ever change the length of >> the key for a vnode. Probably not. > > As I recall from when I was looking at this a couple weeks ago (feels > like a minor eternity ago, but it can't be much longer than that) > ... yes, they might. David, they will. nfs/nfs_vnops.c::nfs_lookitup() will change the file handle in the "*npp != NULL" case. Here both the key and its length may change. I overlooked this one as it didn't update the rbtree. To make it worse the memory holding the file handle may get reallocated so it is impossible to do the rekey with one call. The attached diff adds int vcache_rekey_enter(struct mount *mp, struct vnode *vp, const void *old_key, size_t old_key_len, const void *new_key, size_t new_key_len) to prepare the key change. It will allocate a cache node for the new key and lock both the old and the new cache node. It is an error if the new node already exists. void vcache_rekey_exit(struct mount *mp, struct vnode *vp, const void *old_key, size_t old_key_len, const void *new_key, size_t new_key_len) to finish the key change. It will remove the old cache node and setup and unlock the new cache node. Comments, suggestions or objections? -- J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig (Germany)
Attachment:
vcache.diff
Description: Binary data