aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorMiklos Szeredi <szmi@users.noreply.github.com>2019-01-22 21:03:00 +0100
committerNikolaus Rath <Nikolaus@rath.org>2019-01-22 20:03:00 +0000
commit63d53ecc3addb6fcf3d7f38f2de6822ba37bfd2d (patch)
tree004b29a8a26a6e801a5abc9c50bbaec689efe76a /example
parent1a7399a216e427dbf26bedcbbcbdc5e9c5650fe5 (diff)
downloadlibfuse-63d53ecc3addb6fcf3d7f38f2de6822ba37bfd2d.tar.gz
passthrough_ll: lo_create() should honor CACHE_NEVER (#345)
lo_create() did not honour CACHE_NEVER in lo_create(), which has an effect on how I/O is performed after the open. The value of CACHE_ALWAYS, which results in setting fi->keep_cache, only has an effect for the state of the cache at open, and since the file was just created the cache is always empty. Hence setting this doesn't have an effect on lo_create(), but keep it for symmetry with lo_open().
Diffstat (limited to 'example')
-rw-r--r--example/passthrough_ll.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/example/passthrough_ll.c b/example/passthrough_ll.c
index abb7ec9..1598958 100644
--- a/example/passthrough_ll.c
+++ b/example/passthrough_ll.c
@@ -773,6 +773,7 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
mode_t mode, struct fuse_file_info *fi)
{
int fd;
+ struct lo_data *lo = lo_data(req);
struct fuse_entry_param e;
int err;
@@ -786,6 +787,10 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
return (void) fuse_reply_err(req, errno);
fi->fh = fd;
+ if (lo->cache == CACHE_NEVER)
+ fi->direct_io = 1;
+ else if (lo->cache == CACHE_ALWAYS)
+ fi->keep_cache = 1;
err = lo_do_lookup(req, parent, name, &e);
if (err)