mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
FUSE: require valid file/dir handle; drop open_files fallback
Several FUSE ops fell back to looking up a FileInfo via state.open_files when the kernel-provided fh was zero, returning -ENOENT if the lookup failed. This path papered over handle-tracking bugs and added cost on every call. Use the handle directly and return -EBADF when it is invalid - the kernel should always hand us a valid fh for an open resource. Also simplify FileInfo::from_fh / DirInfo::from_fh and their to_fh helpers: callers now handle the null-pointer case explicitly so the ASSERT_NOT_NULL checks are redundant. Covers fallocate, fchmod, fchown, fgetattr, flock, ftruncate, futimens, read, release, releasedir, write, statx, ioctl (file + dir), readdir (sequential, concurrent-on-read, concurrent-on-search), and the passthrough fast paths in create/open.
This commit is contained in:
parent
0dcca0f1a3
commit
98648ae44b
21 changed files with 74 additions and 143 deletions
|
|
@ -36,6 +36,9 @@ FUSE::ReadDirSeq::operator()(const fuse_req_ctx_t *ctx_,
|
|||
{
|
||||
DirInfo *di = DirInfo::from_fh(ffi_->fh);
|
||||
|
||||
if(not di)
|
||||
return -EBADF;
|
||||
|
||||
return ::_readdir(cfg.branches,
|
||||
di->fusepath,
|
||||
dirents_);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue