pxar: create: attempt to use O_NOATIME
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
e51be33807
commit
30c3c5d66c
|
@ -261,24 +261,32 @@ impl<'a, 'b> Archiver<'a, 'b> {
|
||||||
// common flags we always want to use:
|
// common flags we always want to use:
|
||||||
let oflags = oflags | OFlag::O_CLOEXEC | OFlag::O_NOCTTY;
|
let oflags = oflags | OFlag::O_CLOEXEC | OFlag::O_NOCTTY;
|
||||||
|
|
||||||
match Fd::openat(
|
let mut noatime = OFlag::O_NOATIME;
|
||||||
&unsafe { RawFdNum::from_raw_fd(parent) },
|
loop {
|
||||||
file_name,
|
return match Fd::openat(
|
||||||
oflags,
|
&unsafe { RawFdNum::from_raw_fd(parent) },
|
||||||
Mode::empty(),
|
file_name,
|
||||||
) {
|
oflags | noatime,
|
||||||
Ok(fd) => Ok(Some(fd)),
|
Mode::empty(),
|
||||||
Err(nix::Error::Sys(Errno::ENOENT)) => {
|
) {
|
||||||
if existed {
|
Ok(fd) => Ok(Some(fd)),
|
||||||
self.report_vanished_file()?;
|
Err(nix::Error::Sys(Errno::ENOENT)) => {
|
||||||
|
if existed {
|
||||||
|
self.report_vanished_file()?;
|
||||||
|
}
|
||||||
|
Ok(None)
|
||||||
}
|
}
|
||||||
Ok(None)
|
Err(nix::Error::Sys(Errno::EACCES)) => {
|
||||||
|
writeln!(self.errors, "failed to open file: {:?}: access denied", file_name)?;
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
Err(nix::Error::Sys(Errno::EPERM)) if !noatime.is_empty() => {
|
||||||
|
// Retry without O_NOATIME:
|
||||||
|
noatime = OFlag::empty();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Err(other) => Err(Error::from(other)),
|
||||||
}
|
}
|
||||||
Err(nix::Error::Sys(Errno::EACCES)) => {
|
|
||||||
writeln!(self.errors, "failed to open file: {:?}: access denied", file_name)?;
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
Err(other) => Err(Error::from(other)),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue