mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-29 16:37:07 +00:00
fix(connect): ignore directory link-count churn (#6658)
This commit is contained in:
@@ -1083,10 +1083,10 @@ fn unix_regular_file_is_secure(owner: u32, mode: u32, links: u64, process: u32)
|
|||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
#[allow(dead_code)] // Used by the crate-private stopped-server reader.
|
#[allow(dead_code)] // Used by the crate-private stopped-server reader.
|
||||||
fn file_identity(file: &fs::File) -> Result<(u64, u64, u64), InventoryError> {
|
fn file_identity(file: &fs::File) -> Result<(u64, u64), InventoryError> {
|
||||||
use std::os::unix::fs::MetadataExt as _;
|
use std::os::unix::fs::MetadataExt as _;
|
||||||
let metadata = file.metadata().map_err(|_| InventoryError::StateIo)?;
|
let metadata = file.metadata().map_err(|_| InventoryError::StateIo)?;
|
||||||
Ok((metadata.dev(), metadata.ino(), metadata.nlink()))
|
Ok((metadata.dev(), metadata.ino()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
|
|||||||
@@ -607,6 +607,9 @@ mod tests {
|
|||||||
_lock: lock,
|
_lock: lock,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Directory link counts change when unrelated sibling directories
|
||||||
|
// come and go; that must not look like an anchored path replacement.
|
||||||
|
std::fs::create_dir(temp.path().join("unrelated-sibling")).expect("unrelated sibling directory");
|
||||||
drop(runtime);
|
drop(runtime);
|
||||||
assert!(matches!(store.try_runtime_lock(), Err(InventoryError::AlreadyRunning)));
|
assert!(matches!(store.try_runtime_lock(), Err(InventoryError::AlreadyRunning)));
|
||||||
release.send(()).expect("release inventory task");
|
release.send(()).expect("release inventory task");
|
||||||
|
|||||||
Reference in New Issue
Block a user