Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,25 @@ static int cache_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
pthread_mutex_unlock(&cache.lock);

cfi = (struct file_handle*) fi->fh;
if(cfi->is_open)
fi->fh = cfi->fs_fh;
else {
if (cfi->is_open) {
/*
* We only reach here when the cached listing was missing or
* had been invalidated (e.g. by a create/delete/rename
* through this mount) - the fast path above already returned
* for a valid cache hit. The remote directory stream behind
* fs_fh is positional: if it was already read to EOF by an
* earlier call, reusing it here just returns EOF again,
* making the directory appear empty even though its contents
* changed. Close it and open a fresh handle so the read
* below actually reflects the current directory.
*/
if (cache.next_oper->releasedir) {
fi->fh = cfi->fs_fh;
cache.next_oper->releasedir(path, fi);
}
cfi->is_open = 0;
}
if (!cfi->is_open) {
if(cache.next_oper->opendir) {
err = cache.next_oper->opendir(path, fi);
if(err)
Expand Down