fuse: add readdir cache version

Allow the cache to be invalidated when page(s) have gone missing.  In this
case increment the version of the cache and reset to an empty state.

Add a version number to the directory stream in struct fuse_file as well,
indicating the version of the cache it's supposed to be reading.  If the
cache version doesn't match the stream's version, then reset the stream to
the beginning of the cache.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
Miklos Szeredi
2018-10-01 10:07:04 +02:00
parent 5d7bc7e868
commit 3494927e09
3 changed files with 52 additions and 1 deletions

View File

@@ -104,6 +104,7 @@ static struct inode *fuse_alloc_inode(struct super_block *sb)
fi->rdc.cached = false;
fi->rdc.size = 0;
fi->rdc.pos = 0;
fi->rdc.version = 0;
mutex_init(&fi->mutex);
fi->forget = fuse_alloc_forget();
if (!fi->forget) {