Generalize safe host-to-isolated rename migration
This commit is contained in:
parent
aaee63a6e3
commit
35ab7f17c0
1 changed files with 589 additions and 81 deletions
|
|
@ -351,7 +351,6 @@ impl Filesystem for IgnoredWorkspace {
|
|||
if source_entry.backing != destination_backing {
|
||||
let supported_flags =
|
||||
flags.is_empty() || flags == FuseRenameFlags::RENAME_NOREPLACE;
|
||||
let directory = source_entry.stat.st_mode & libc::S_IFMT == libc::S_IFDIR;
|
||||
if source_entry.backing != Classification::Host
|
||||
|| destination_backing != Classification::Isolated
|
||||
{
|
||||
|
|
@ -364,10 +363,13 @@ impl Filesystem for IgnoredWorkspace {
|
|||
);
|
||||
return Err(io::Error::from_raw_os_error(libc::EXDEV));
|
||||
}
|
||||
if !directory {
|
||||
if !matches!(
|
||||
source_entry.stat.st_mode & libc::S_IFMT,
|
||||
libc::S_IFREG | libc::S_IFDIR | libc::S_IFLNK
|
||||
) {
|
||||
let _ = writeln!(
|
||||
io::stderr().lock(),
|
||||
"lazaret ignored-workspace refused host-to-isolated migration: source is not a directory"
|
||||
"lazaret ignored-workspace refused host-to-isolated migration: source type has no copy semantics"
|
||||
);
|
||||
return Err(io::Error::from_raw_os_error(libc::EXDEV));
|
||||
}
|
||||
|
|
@ -388,6 +390,7 @@ impl Filesystem for IgnoredWorkspace {
|
|||
&provenance,
|
||||
&source,
|
||||
&destination,
|
||||
flags.is_empty(),
|
||||
)?;
|
||||
provenance.remove_tree(&source);
|
||||
return Ok(());
|
||||
|
|
@ -492,6 +495,10 @@ impl Filesystem for IgnoredWorkspace {
|
|||
_lock_owner: Option<LockOwner>,
|
||||
reply: ReplyWrite,
|
||||
) {
|
||||
let _namespace = self
|
||||
.namespace
|
||||
.read()
|
||||
.unwrap_or_else(std::sync::PoisonError::into_inner);
|
||||
let result = self.with_file(handle, |open| {
|
||||
open.migration_quiesced.store(false, Ordering::Release);
|
||||
let offset = if flags.0 & libc::O_APPEND != 0 {
|
||||
|
|
@ -1005,6 +1012,10 @@ impl Filesystem for IgnoredWorkspace {
|
|||
reply.error(Errno::EINVAL);
|
||||
return;
|
||||
}
|
||||
let _namespace = self
|
||||
.namespace
|
||||
.read()
|
||||
.unwrap_or_else(std::sync::PoisonError::into_inner);
|
||||
let files = self
|
||||
.files
|
||||
.lock()
|
||||
|
|
|
|||
Loading…
Reference in a new issue