From 4fe9213b90f525c74dcf2d247749d373838b5b8e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 31 Aug 2017 18:44:01 -0400 Subject: [PATCH] osd/PrimaryLogPG: do_op: use head on for LIST_SNAPS Use head oid even for LIST_SNAPS op. This doesn't really affect LIST_SNAPS but it *does* mean that we never call find_object_context on a snapdir oid. Signed-off-by: Sage Weil --- src/osd/PrimaryLogPG.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 516a25d1b20aa..d411615829e8c 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -2080,7 +2080,14 @@ void PrimaryLogPG::do_op(OpRequestRef& op) ObjectContextRef obc; bool can_create = op->may_write() || op->may_cache(); hobject_t missing_oid; - const hobject_t& oid = m->get_hobj(); + + // kludge around the fact that LIST_SNAPS sets CEPH_SNAPDIR for LIST_SNAPS + hobject_t _oid_head; + if (m->get_snapid() == CEPH_SNAPDIR) { + _oid_head = m->get_hobj().get_head(); + } + const hobject_t& oid = + m->get_snapid() == CEPH_SNAPDIR ? _oid_head : m->get_hobj(); // make sure LIST_SNAPS is on CEPH_SNAPDIR and nothing else for (vector::iterator p = m->ops.begin(); p != m->ops.end(); ++p) { -- 2.39.5