From d721c1e0d7cea2d1bde72ae5344615b7be96a434 Mon Sep 17 00:00:00 2001 From: Xin Yin Date: Tue, 19 Jul 2022 14:12:18 +0800 Subject: [PATCH] storage: fix io error may let the chunk map bit always pending For now , when we get an io error in do_fetch_chunks, we just return without clearing the chunk map pending bit. This may cause the following io always wait for the pending bits. Signed-off-by: Xin Yin --- storage/src/cache/cachedfile.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/storage/src/cache/cachedfile.rs b/storage/src/cache/cachedfile.rs index e8a413fb7f7..8f4cf8dc965 100644 --- a/storage/src/cache/cachedfile.rs +++ b/storage/src/cache/cachedfile.rs @@ -442,9 +442,13 @@ impl FileCacheEntry { self.adjust_buffer_for_dio(buf) } trace!("persist_chunk idx {}", idx); - Self::persist_chunk(&self.file, offset, buf).map_err(|e| { - eio!(format!("do_fetch_chunk failed to persist data, {:?}", e)) - })?; + if let Err(e) = Self::persist_chunk(&self.file, offset, buf) { + bitmap.clear_range_pending(pending[start], (end - start) as u32); + return Err(eio!(format!( + "do_fetch_chunk failed to persist data, {:?}", + e + ))); + } } bitmap