From e2dbb8058261e8cc3a3fb00362e2785f0ac6cf18 Mon Sep 17 00:00:00 2001 From: Zengran Zhang Date: Tue, 11 Dec 2018 19:32:55 +0800 Subject: [PATCH] osd: keep using cache even if op will invalid cache the current wrong process on same obj in ec 4+2 pool with 16K stripe: obj has 16K~16K with content-0 new op1 will write 8K~32K (16K~16K content-1) op1 reserve 0K~48K in cache op1 read 0~16K & 32K~48K from disk new op2 will write 20K~24K (20K~4K content-2) *** (invalid_cache dur to clone) op2 read 16K~32K from disk (content-0) ***** dur to not using_cache op1 write 0~48K to disk (content-1) op1 present 0~48K to cache (content-1) op2 write 16~32K to disk (content-0 + content-2) *** here we drop the content1 even if the op will invalid cache, it should do that *after* itself, the op should use the cache by itself. Signed-off-by: Zengran Zhang --- src/osd/ECBackend.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index bc9c4c46086..b979545c052 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -1838,13 +1838,12 @@ bool ECBackend::try_state_to_reads() return false; } + op->using_cache = pipeline_state.caching_enabled(); + if (op->invalidates_cache()) { dout(20) << __func__ << ": invalidating cache after this op" << dendl; pipeline_state.invalidate(); - op->using_cache = false; - } else { - op->using_cache = pipeline_state.caching_enabled(); } waiting_state.pop_front(); -- 2.39.5