mirror of
https://github.com/trapexit/mergerfs.git
synced 2024-11-22 04:59:19 +08:00
Ensure lookups of FUSE_ROOT_ID always return generation=0
This commit is contained in:
parent
85a936c95e
commit
951eb9540d
|
@ -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,
|
||||
|
|
|
@ -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…
Reference in New Issue
Block a user