mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-04-03 02:09:03 +08:00
Merge pull request #237 from trapexit/renamefix
This commit is contained in:
commit
81b9918f6b
@ -142,6 +142,29 @@ _rename_create_path(Policy::Func::Search searchFunc,
|
|||||||
return -error;
|
return -error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
int
|
||||||
|
_clonepath(Policy::Func::Search searchFunc,
|
||||||
|
const vector<string> &srcmounts,
|
||||||
|
const size_t minfreespace,
|
||||||
|
const string &dstbasepath,
|
||||||
|
const string &fusedirpath)
|
||||||
|
{
|
||||||
|
int rv;
|
||||||
|
vector<const string*> srcbasepath;
|
||||||
|
|
||||||
|
rv = searchFunc(srcmounts,fusedirpath.c_str(),minfreespace,srcbasepath);
|
||||||
|
if(POLICY_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
{
|
||||||
|
const ugid::SetRootGuard ugidGuard;
|
||||||
|
fs::clonepath(*srcbasepath[0],dstbasepath,fusedirpath.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
return POLICY_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
_clonepath_if_would_create(Policy::Func::Search searchFunc,
|
_clonepath_if_would_create(Policy::Func::Search searchFunc,
|
||||||
@ -163,18 +186,7 @@ _clonepath_if_would_create(Policy::Func::Search searchFunc,
|
|||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
if(oldbasepath == *newbasepath[0])
|
if(oldbasepath == *newbasepath[0])
|
||||||
{
|
return _clonepath(searchFunc,srcmounts,minfreespace,oldbasepath,newfusedirpath);
|
||||||
rv = searchFunc(srcmounts,newfusedirpath.c_str(),minfreespace,newbasepath);
|
|
||||||
if(POLICY_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
{
|
|
||||||
const ugid::SetRootGuard ugidGuard;
|
|
||||||
fs::clonepath(*newbasepath[0],oldbasepath,newfusedirpath.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
return POLICY_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
return POLICY_FAIL_ERRNO(EXDEV);
|
return POLICY_FAIL_ERRNO(EXDEV);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user