@@ -565,7 +565,7 @@ static void afs_zap_data(struct afs_vnode *vnode)
_enter("{%llx:%llu}", vnode->fid.vid, vnode->fid.vnode);
#ifdef CONFIG_AFS_FSCACHE
- fscache_invalidate(vnode->cache);
+ fscache_invalidate(vnode->cache, i_size_read(&vnode->vfs_inode));
#endif
/* nuke all the non-dirty pages that aren't locked, mapped or being
@@ -704,7 +704,7 @@ static void fscache_invalidate_cookie(struct fscache_cookie *cookie)
/*
* Invalidate an object. Callable with spinlocks held.
*/
-void __fscache_invalidate(struct fscache_cookie *cookie)
+void __fscache_invalidate(struct fscache_cookie *cookie, loff_t new_size)
{
bool is_caching;
@@ -718,6 +718,7 @@ void __fscache_invalidate(struct fscache_cookie *cookie)
spin_lock(&cookie->lock);
set_bit(FSCACHE_COOKIE_NO_DATA_TO_READ, &cookie->flags);
+ cookie->object_size = new_size;
cookie->inval_counter++;
switch (cookie->stage) {
@@ -159,7 +159,7 @@ extern struct fscache_cookie *__fscache_acquire_cookie(
extern void __fscache_use_cookie(struct fscache_cookie *, bool);
extern void __fscache_unuse_cookie(struct fscache_cookie *, const void *, const loff_t *);
extern void __fscache_relinquish_cookie(struct fscache_cookie *, bool);
-extern void __fscache_invalidate(struct fscache_cookie *);
+extern void __fscache_invalidate(struct fscache_cookie *, loff_t);
#ifdef FSCACHE_USE_NEW_IO_API
extern int __fscache_begin_read_operation(struct netfs_cache_resources *, struct fscache_cookie *);
#endif
@@ -388,6 +388,7 @@ void fscache_unpin_cookie(struct fscache_cookie *cookie)
/**
* fscache_invalidate - Notify cache that an object needs invalidation
* @cookie: The cookie representing the cache object
+ * @size: The revised size of the object.
*
* Notify the cache that an object is needs to be invalidated and that it
* should abort any retrievals or stores it is doing on the cache. The object
@@ -399,10 +400,10 @@ void fscache_unpin_cookie(struct fscache_cookie *cookie)
* description.
*/
static inline
-void fscache_invalidate(struct fscache_cookie *cookie)
+void fscache_invalidate(struct fscache_cookie *cookie, loff_t size)
{
if (fscache_cookie_valid(cookie))
- __fscache_invalidate(cookie);
+ __fscache_invalidate(cookie, size);
}
/**
Note the size of the cache object during invalidation. For AFS, we set this to the file size when invalidating a file due to third-party interference. Signed-off-by: David Howells <dhowells@redhat.com> --- fs/afs/inode.c | 2 +- fs/fscache/cookie.c | 3 ++- include/linux/fscache.h | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-)