fix #2871: close FDs when scanning backup group
otherwise we leak those descriptors and run into EMFILE when a backup group contains many snapshots. fcntl::openat and Dir::openat are not the same ;) Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
c1c4a18f48
commit
25455bd06d
@ -106,7 +106,11 @@ impl BackupGroup {
|
||||
|
||||
use nix::fcntl::{openat, OFlag};
|
||||
match openat(l2_fd, &manifest_path, OFlag::O_RDONLY, nix::sys::stat::Mode::empty()) {
|
||||
Ok(_) => { /* manifest exists --> assume backup was successful */ },
|
||||
Ok(rawfd) => {
|
||||
/* manifest exists --> assume backup was successful */
|
||||
/* close else this leaks! */
|
||||
nix::unistd::close(rawfd)?;
|
||||
},
|
||||
Err(nix::Error::Sys(nix::errno::Errno::ENOENT)) => { return Ok(()); }
|
||||
Err(err) => {
|
||||
bail!("last_successful_backup: unexpected error - {}", err);
|
||||
|
Loading…
Reference in New Issue
Block a user