diff --git a/Cargo.toml b/Cargo.toml index 072e8615b..59847167a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,7 +55,7 @@ hyper = { version = "0.14", features = [ "full" ] } hyper-staticfile = "0.9" indicatif = { version = "0.17.7", features = ["rayon"] } itertools = "0.12.0" -libc = "0.2.151" +libc = "0.2" mime_guess = "2.0.4" nbd = "0.2.3" nix = { version = "0.26", features = [ "feature", "uio" ] } diff --git a/upstairs/src/volume.rs b/upstairs/src/volume.rs index e388767e0..7a98e6984 100644 --- a/upstairs/src/volume.rs +++ b/upstairs/src/volume.rs @@ -274,6 +274,7 @@ impl Volume { sv_vec } + #[allow(clippy::if_same_then_else)] pub fn read_only_parent_for_lba_range( &self, start: u64, @@ -282,7 +283,10 @@ impl Volume { if let Some(ref read_only_parent) = self.read_only_parent { // Check if the scrubber has passed this offset let scrub_point = self.scrub_point.load(Ordering::SeqCst); - if start + length <= scrub_point { + if scrub_point >= read_only_parent.lba_range.end { + // No need to check ROP, the scrub is done. + None + } else if start + length <= scrub_point { None } else { read_only_parent.lba_range_coverage(start, length) @@ -3009,6 +3013,14 @@ mod test { block, size, scrub_point, ); assert!(r.is_none()); + } else if scrub_point >= parent_blocks { + // We have completed the scrub of the ROP, so we + // go directly to the SubVolume + println!( + "scrub_point {} >= size {}, scrub done. No check", + scrub_point, parent_blocks + ); + assert!(r.is_none()); } else { // Our IO is not fully under the scrub point, but we // know it's still below the