mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
FUSE: pass Branches::Ptr by value with empty-branches guards
Previously most FUSE ops took a reference to the live cfg.branches object. With atomic_load now producing a shared_ptr snapshot, pass it by value: the op works against a single stable view of the configuration for its whole lifetime, immune to concurrent reconfiguration. Also bail out with -ENOENT when the policy returns an empty branch set rather than dereferencing branches[0]. This was reachable if a policy rejected every branch (e.g. everything readonly while looking for a writable target). Covers access, chmod, chown, create, getattr, getxattr, ioctl, link, listxattr, mkdir, mknod, open, readdir (cor/cosr), readlink, removexattr, rename, rmdir, setxattr, statfs, statx, symlink, truncate, unlink, utimens. While here, in _getattr only dereference st_->st_mode when lstat succeeded (it is otherwise uninitialized).
This commit is contained in:
parent
98648ae44b
commit
0c17492c78
25 changed files with 110 additions and 45 deletions
|
|
@ -103,7 +103,7 @@ int
|
|||
_mkdir(const ugid_t ugid_,
|
||||
const Policy::Search &getattrPolicy_,
|
||||
const Policy::Create &mkdirPolicy_,
|
||||
const Branches &branches_,
|
||||
const Branches::Ptr branches_,
|
||||
const fs::path &fusepath_,
|
||||
const mode_t mode_,
|
||||
const mode_t umask_)
|
||||
|
|
@ -118,10 +118,14 @@ _mkdir(const ugid_t ugid_,
|
|||
rv = getattrPolicy_(branches_,fusedirpath,existingbranches);
|
||||
if(rv < 0)
|
||||
return rv;
|
||||
if(existingbranches.empty())
|
||||
return -ENOENT;
|
||||
|
||||
rv = mkdirPolicy_(branches_,fusedirpath,createbranches);
|
||||
if(rv < 0)
|
||||
return rv;
|
||||
if(createbranches.empty())
|
||||
return -ENOENT;
|
||||
|
||||
return ::_mkdir_loop(ugid_,
|
||||
existingbranches[0],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue