]> asedeno.scripts.mit.edu Git - linux.git/commit
afs: Use the vnode ID uniquifier in the cache key not the aux data
authorDavid Howells <dhowells@redhat.com>
Wed, 4 Apr 2018 12:41:25 +0000 (13:41 +0100)
committerDavid Howells <dhowells@redhat.com>
Wed, 4 Apr 2018 12:41:25 +0000 (13:41 +0100)
commit27a3ee3a0471abaacf0c2ab1397b188c7b693fcd
treeee791b6c562b287637539c8c2968b3dbbdd5ce55
parentc1515999bdf9a91a4b7c82623a068ffe770a17b9
afs: Use the vnode ID uniquifier in the cache key not the aux data

AFS vnodes (files) are referenced by a triplet of { volume ID, vnode ID,
uniquifier }.  Currently, kafs is only using the vnode ID as the file key
in the volume fscache index and checking the uniquifier on cookie
acquisition against the contents of the auxiliary data stored in the cache.

Unfortunately, this is subject to a race in which an FS.RemoveFile or
FS.RemoveDir op is issued against the server but the local afs inode isn't
torn down and disposed off before another thread issues something like
FS.CreateFile.  The latter then gets given the vnode ID that just got
removed, but with a new uniquifier and a cookie collision occurs in the
cache because the cookie is only keyed on the vnode ID whereas the inode is
keyed on the vnode ID plus the uniquifier.

Fix this by keying the cookie on the uniquifier in addition to the vnode ID
and dropping the uniquifier from the auxiliary data supplied.

Signed-off-by: David Howells <dhowells@redhat.com>
fs/afs/cache.c