From b20a1ba52c69b6e722ca28e92d4d367574b075b2 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 1 Oct 2015 12:11:18 -0700 Subject: [PATCH] ReplicatedPG: consider IGNORE_CACHE for all maybe_handle_cache calls Otherwise, we could erroneously promote a snap after not promoting the missing head for which we have a cached obc and ssc. Fixes: #13323 Signed-off-by: Samuel Just --- src/osd/ReplicatedPG.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 857ed09b38af6..ea616f0aefb89 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1702,8 +1702,13 @@ void ReplicatedPG::do_op(OpRequestRef& op) return; } - if (!(m->has_flag(CEPH_OSD_FLAG_IGNORE_CACHE)) && - maybe_handle_cache(op, write_ordered, obc, r, missing_oid, false, in_hit_set)) + if (maybe_handle_cache(op, + write_ordered, + obc, + r, + missing_oid, + false, + in_hit_set)) return; if (r && (r != -ENOENT || !obc)) { @@ -1939,6 +1944,14 @@ bool ReplicatedPG::maybe_handle_cache(OpRequestRef op, bool must_promote, bool in_hit_set) { + if (op && + op->get_req() && + op->get_req()->get_type() == CEPH_MSG_OSD_OP && + (static_cast(op->get_req())->get_flags() & + CEPH_OSD_FLAG_IGNORE_CACHE)) { + dout(20) << __func__ << ": ignoring cache due to flag" << dendl; + return false; + } // return quickly if caching is not enabled if (pool.info.cache_mode == pg_pool_t::CACHEMODE_NONE) return false; -- 2.39.5