From a45ffd896ad8b45901917edb845d4011db46d6b4 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Mon, 14 Aug 2017 10:40:41 +0100 Subject: [PATCH] [block-cache] writeback could get stuck in a loop If a block had a non zero ref count. --- block-cache/block_cache.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/block-cache/block_cache.cc b/block-cache/block_cache.cc index 5e72cd8..f20a210 100644 --- a/block-cache/block_cache.cc +++ b/block-cache/block_cache.cc @@ -265,13 +265,11 @@ block_cache::writeback(unsigned count) if (actual == count) break; - // The block may be on the dirty list from a prior - // acquisition. - if (it->ref_count_) - continue; - - issue_write(*it); - actual++; + // We can't writeback anything that's still in use. + if (!it->ref_count_) { + issue_write(*it); + actual++; + } it = next; }