Browse Source

Ensure lookups of FUSE_ROOT_ID always return generation=0

pull/1309/head
Antonio SJ Musumeci 10 months ago
parent
commit
951eb9540d
  1. 11
      libfuse/lib/fuse.c
  2. 5
      libfuse/lib/fuse_lowlevel.c

11
libfuse/lib/fuse.c

@ -1375,7 +1375,7 @@ set_path_info(struct fuse *f,
return -ENOMEM;
e->ino = node->nodeid;
e->generation = f->nodeid_gen.generation;
e->generation = ((e->ino == FUSE_ROOT_ID) ? 0 : f->nodeid_gen.generation);
pthread_mutex_lock(&f->lock);
update_stat(node,&e->attr);
@ -1386,6 +1386,15 @@ set_path_info(struct fuse *f,
return 0;
}
/*
lookup requests only come in for FUSE_ROOT_ID when a "parent of
child of root node" request is made. This can happen when using
EXPORT_SUPPORT=true and a file handle is used to keep a reference to
a node which has been forgotten. Mostly a NFS concern but not
excluslively. Root node always has a nodeid of 1 and generation of
0. To ensure this set_path_info() explicitly ensures the root id has
a generation of 0.
*/
static
int
lookup_path(struct fuse *f,

5
libfuse/lib/fuse_lowlevel.c

@ -294,6 +294,11 @@ fuse_reply_entry(fuse_req_t req,
fill_entry(&arg, e);
#ifdef NDEBUG
// TODO: Add checks for cases where a node could be marked bad by
// the kernel.
#endif
return send_reply_ok(req, &arg, size);
}

Loading…
Cancel
Save