afs: Be more aggressive in retiring cached vnodes
authorDavid Howells <dhowells@redhat.com>
Wed, 4 Apr 2018 12:41:26 +0000 (13:41 +0100)
committerDavid Howells <dhowells@redhat.com>
Wed, 4 Apr 2018 12:41:26 +0000 (13:41 +0100)
When relinquishing cookies, either due to iget failure or to inode
eviction, retire a cookie if we think the corresponding vnode got deleted
on the server rather than just letting it lie in the cache.

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

index 42f83fd5a8969636c2a86579b3f65df3bc616136..c942c79fc5f086cc095e542381bc38f31cae4fc5 100644 (file)
@@ -327,7 +327,7 @@ struct inode *afs_iget(struct super_block *sb, struct key *key,
        /* failure */
 bad_inode:
 #ifdef CONFIG_AFS_FSCACHE
-       fscache_relinquish_cookie(vnode->cache, 0);
+       fscache_relinquish_cookie(vnode->cache, ret == -ENOENT);
        vnode->cache = NULL;
 #endif
        iget_failed(inode);
@@ -511,7 +511,8 @@ void afs_evict_inode(struct inode *inode)
        }
 
 #ifdef CONFIG_AFS_FSCACHE
-       fscache_relinquish_cookie(vnode->cache, 0);
+       fscache_relinquish_cookie(vnode->cache,
+                                 test_bit(AFS_VNODE_DELETED, &vnode->flags));
        vnode->cache = NULL;
 #endif