diff --git a/libfuse/lib/fuse.c b/libfuse/lib/fuse.c index f766f334..3cb3b5ad 100644 --- a/libfuse/lib/fuse.c +++ b/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, diff --git a/libfuse/lib/fuse_lowlevel.c b/libfuse/lib/fuse_lowlevel.c index 37f24dd3..96511568 100644 --- a/libfuse/lib/fuse_lowlevel.c +++ b/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); }