backup: index readers: drop useless shared lock
This is only acquired in those two methods, both as shared. So it has no use. It seems, that it was planned in the past that the index deletion should take the exclusive, while read and write takes the shared flock on the index, as one can guess from the lock comments in commit0465218953
But then later, in commitc8ec450e37
) the documented semantics where changed to use a temp file and do an atomic rename instead for atomicity. The reader shared flock on the index file was done inbetween, probably as preparatory step, but was not removed again when strategy was changed to using the file rename instead. Do so now, to avoid confusion of readers and a useless flock. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
b0b00c4a47
commit
fe0efb25e8
|
@ -90,12 +90,6 @@ impl DynamicIndexReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(mut file: std::fs::File) -> Result<Self, Error> {
|
pub fn new(mut file: std::fs::File) -> Result<Self, Error> {
|
||||||
if let Err(err) =
|
|
||||||
nix::fcntl::flock(file.as_raw_fd(), nix::fcntl::FlockArg::LockSharedNonblock)
|
|
||||||
{
|
|
||||||
bail!("unable to get shared lock - {}", err);
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: This is NOT OUR job! Check the callers of this method and remove this!
|
// FIXME: This is NOT OUR job! Check the callers of this method and remove this!
|
||||||
file.seek(SeekFrom::Start(0))?;
|
file.seek(SeekFrom::Start(0))?;
|
||||||
|
|
||||||
|
|
|
@ -65,12 +65,6 @@ impl FixedIndexReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(mut file: std::fs::File) -> Result<Self, Error> {
|
pub fn new(mut file: std::fs::File) -> Result<Self, Error> {
|
||||||
if let Err(err) =
|
|
||||||
nix::fcntl::flock(file.as_raw_fd(), nix::fcntl::FlockArg::LockSharedNonblock)
|
|
||||||
{
|
|
||||||
bail!("unable to get shared lock - {}", err);
|
|
||||||
}
|
|
||||||
|
|
||||||
file.seek(SeekFrom::Start(0))?;
|
file.seek(SeekFrom::Start(0))?;
|
||||||
|
|
||||||
let header_size = std::mem::size_of::<FixedIndexHeader>();
|
let header_size = std::mem::size_of::<FixedIndexHeader>();
|
||||||
|
|
Loading…
Reference in New Issue