diff --git a/src/chown.cpp b/src/chown.cpp index e2df0259..2c5ff821 100644 --- a/src/chown.cpp +++ b/src/chown.cpp @@ -96,20 +96,20 @@ namespace mergerfs uid_t uid, gid_t gid) { -/* const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); + if(config.cifs) + return 0; + return _chown(config.chown, config.srcmounts, config.minfreespace, fusepath, uid, gid); -*/ - return 0; } } } diff --git a/src/config.cpp b/src/config.cpp index e0c3de3e..4247beee 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -40,6 +40,7 @@ namespace mergerfs minfreespace(MINFREESPACE_DEFAULT), moveonenospc(false), direct_io(false), + cifs(false), POLICYINIT(access), POLICYINIT(chmod), POLICYINIT(chown), diff --git a/src/config.hpp b/src/config.hpp index 0ec36d04..5aaa025a 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -48,6 +48,7 @@ namespace mergerfs uint64_t minfreespace; bool moveonenospc; bool direct_io; + bool cifs; public: const Policy *policies[FuseFunc::Enum::END]; diff --git a/src/fs_clonepath.cpp b/src/fs_clonepath.cpp index dcfae384..6f3cb082 100644 --- a/src/fs_clonepath.cpp +++ b/src/fs_clonepath.cpp @@ -26,8 +26,10 @@ #include "fs_clonepath.hpp" #include "fs_path.hpp" #include "fs_xattr.hpp" +#include "config.hpp" using std::string; +using mergerfs::Config; static bool @@ -59,6 +61,9 @@ namespace fs string frompath; string dirname; + const fuse_context *fc = fuse_get_context(); + const Config &config = Config::get(fc); + dirname = relative; fs::path::dirname(dirname); if(!dirname.empty()) @@ -96,9 +101,11 @@ namespace fs if((rv == -1) && !ignorable_error(errno)) return -1; - rv = fs::chown(topath,st); - //if(rv == -1) - // return -1; + if(!config.cifs) { + rv = fs::chown(topath,st); + if(rv == -1) + return -1; + } rv = fs::utime(topath,st); if(rv == -1) diff --git a/src/option_parser.cpp b/src/option_parser.cpp index 0ad72880..a586e326 100644 --- a/src/option_parser.cpp +++ b/src/option_parser.cpp @@ -143,6 +143,8 @@ parse_and_process_arg(Config &config, return (set_default_options(*outargs),0); else if(arg == "direct_io") return (config.direct_io=true,1); + else if(arg == "cifs") + return (config.cifs=true,0); return 1; } @@ -260,6 +262,8 @@ usage(void) " on write: default false\n" " -o func.=

set function to policy

\n" " -o category.=

set functions in category to

\n" + " -o cifs disable chown command execution as CIFS\n" + " don't support it\n" << std::endl; }