From: Samuel Just Date: Thu, 1 Oct 2015 19:11:18 +0000 (-0700) Subject: ReplicatedPG: consider IGNORE_CACHE for all maybe_handle_cache calls X-Git-Tag: v9.1.0~27^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b20a1ba52c69b6e722ca28e92d4d367574b075b2;p=ceph.git 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 --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 857ed09b38af..ea616f0aefb8 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;