add 'ignore path preserving on rename' feature

This commit is contained in:
Antonio SJ Musumeci 2017-06-29 23:57:15 -04:00
parent b95fbd76ec
commit a2bddec8c7
10 changed files with 47 additions and 6 deletions

View file

@ -44,6 +44,7 @@ namespace mergerfs
symlinkify(false),
symlinkify_timeout(3600),
nullrw(false),
ignorepponrename(false),
POLICYINIT(access),
POLICYINIT(chmod),
POLICYINIT(chown),

View file

@ -52,6 +52,7 @@ namespace mergerfs
bool symlinkify;
time_t symlinkify_timeout;
bool nullrw;
bool ignorepponrename;
public:
const Policy *policies[FuseFunc::Enum::END];

View file

@ -193,6 +193,10 @@ _getxattr_controlfile(const Config &config,
_getxattr_controlfile_bool(config.symlinkify,attrvalue);
else if(attr[2] == "symlinkify_timeout")
_getxattr_controlfile_time_t(config.symlinkify_timeout,attrvalue);
else if(attr[2] == "nullrw")
_getxattr_controlfile_bool(config.nullrw,attrvalue);
else if(attr[2] == "ignorepponrename")
_getxattr_controlfile_bool(config.ignorepponrename,attrvalue);
else if(attr[2] == "policies")
_getxattr_controlfile_policies(config,attrvalue);
else if(attr[2] == "version")

View file

@ -240,7 +240,7 @@ namespace mergerfs
const ugid::Set ugid(fc->uid,fc->gid);
const rwlock::ReadGuard readlock(&config.srcmountslock);
if(config.create->path_preserving())
if(config.create->path_preserving() && !config.ignorepponrename)
return _link_preserve_path(config.getattr,
config.link,
config.create,

View file

@ -49,6 +49,8 @@ _listxattr_controlfile(char *list,
("user.mergerfs.dropcacheonclose")
("user.mergerfs.symlinkify")
("user.mergerfs.symlinkify_timeout")
("user.mergerfs.nullrw")
("user.mergerfs.ignorepponrename")
("user.mergerfs.policies")
("user.mergerfs.version")
("user.mergerfs.pid");

View file

@ -192,6 +192,8 @@ parse_and_process_kv_arg(Config &config,
rv = parse_and_process(value,config.symlinkify_timeout);
else if(key == "nullrw")
rv = parse_and_process(value,config.nullrw);
else if(key == "ignorepponrename")
rv = parse_and_process(value,config.ignorepponrename);
}
if(rv == -1)
@ -294,6 +296,9 @@ usage(void)
" timeout in seconds before will turn to symlinks.\n"
" default=3600\n"
" -o nullrw=<bool> Disables reads and writes. For benchmarking.\n"
" -o ignorepponrename=<bool>\n"
" Ignore path preserving when performing renames\n"
" and links. default = false"
<< std::endl;
}

View file

@ -301,7 +301,7 @@ namespace mergerfs
const ugid::Set ugid(fc->uid,fc->gid);
const rwlock::ReadGuard readlock(&config.srcmountslock);
if(config.create->path_preserving())
if(config.create->path_preserving() && !config.ignorepponrename)
return _rename_preserve_path(config.getattr,
config.rename,
config.create,

View file

@ -293,6 +293,10 @@ _setxattr_controlfile(Config &config,
return _setxattr_time_t(attrval,
flags,
config.symlinkify_timeout);
else if(attr[2] == "ignorepponrename")
return _setxattr_bool(attrval,
flags,
config.ignorepponrename);
break;
case 4: