Browse Source

Error when given invalid policy names

pull/1057/head
Antonio SJ Musumeci 2 years ago
parent
commit
46ce28b149
  1. 8
      man/mergerfs.1
  2. 2
      src/category.cpp
  3. 6
      src/func.cpp
  4. 5
      src/mergerfs.cpp
  5. 15
      src/policy.hpp

8
man/mergerfs.1

@ -704,8 +704,8 @@ Even though it\[cq]s a more niche situation this hack breaks normal
security and behavior and as such is \f[C]off\f[R] by default.
If set to \f[C]git\f[R] it will only perform the hack when the path in
question includes \f[C]/.git/\f[R].
\f[C]all\f[R] will result it applying anytime a readonly file which
is empty is opened for writing.
\f[C]all\f[R] will result it applying anytime a readonly file which is
empty is opened for writing.
.SH FUNCTIONS, CATEGORIES and POLICIES
.PP
The POSIX filesystem API is made up of a number of functions.
@ -1643,7 +1643,7 @@ Fast network, slow drives, small\[cq]ish bursty writes: You have a
10+Gbps network and wish to transfer amounts of data less than your
cache drive but wish to do so quickly.
.PP
With #1 it's arguable if you should be using mergerfs at all.
With #1 it\[cq]s arguable if you should be using mergerfs at all.
RAID would probably be the better solution.
If you\[cq]re going to use mergerfs there are other tactics that may
help: spreading the data across drives (see the mergerfs.dup tool) and
@ -1963,7 +1963,7 @@ efficiently determine whether to scan for new content rather than simply
performing a full scan.
If using the default \f[B]getattr\f[R] policy of \f[B]ff\f[R] it\[cq]s
possible those programs will miss an update on account of it returning
the first directory found\[cq]s \f[B]stat\f[R] info and its a later
the first directory found\[cq]s \f[B]stat\f[R] info and it\[cq]s a later
directory on another mount which had the \f[B]mtime\f[R] recently
updated.
To fix this you will want to set \f[B]func.getattr=newest\f[R].

2
src/category.cpp

@ -42,7 +42,7 @@ Category::Base::to_string(void) const
{
std::set<std::string> rv;
for(auto func : funcs)
for(const auto func : funcs)
rv.insert(func->to_string());
return str::join(rv,',');

6
src/func.cpp

@ -23,6 +23,8 @@ int
Func::Base::Action::from_string(const std::string &policyname_)
{
policy = Policies::Action::find(policyname_);
if(!policy)
return -EINVAL;
return 0;
}
@ -37,6 +39,8 @@ int
Func::Base::Create::from_string(const std::string &policyname_)
{
policy = Policies::Create::find(policyname_);
if(!policy)
return -EINVAL;
return 0;
}
@ -51,6 +55,8 @@ int
Func::Base::Search::from_string(const std::string &policyname_)
{
policy = Policies::Search::find(policyname_);
if(!policy)
return -EINVAL;
return 0;
}

5
src/mergerfs.cpp

@ -164,7 +164,10 @@ namespace l
options::parse(&args,&errs);
if(errs.size())
std::cerr << errs << std::endl;
{
std::cerr << errs << std::endl;
return 1;
}
l::setup_resources();
l::get_fuse_operations(ops,cfg->nullrw);

15
src/policy.hpp

@ -73,6 +73,11 @@ namespace Policy
return (*impl)(branches_,fusepath_.c_str(),paths_);
}
operator bool() const
{
return (bool)impl;
}
private:
ActionImpl *impl;
};
@ -134,6 +139,11 @@ namespace Policy
return (*impl)(branches_,fusepath_.c_str(),paths_);
}
operator bool() const
{
return (bool)impl;
}
private:
CreateImpl *impl;
};
@ -188,6 +198,11 @@ namespace Policy
return (*impl)(branches_,fusepath_.c_str(),paths_);
}
operator bool() const
{
return (bool)impl;
}
private:
SearchImpl *impl;
};

Loading…
Cancel
Save