]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PrimaryLogPG: do_op: use head on for LIST_SNAPS
authorSage Weil <sage@redhat.com>
Thu, 31 Aug 2017 22:44:01 +0000 (18:44 -0400)
committerSage Weil <sage@redhat.com>
Mon, 11 Sep 2017 14:13:34 +0000 (09:13 -0500)
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 <sage@redhat.com>
src/osd/PrimaryLogPG.cc

index 516a25d1b20aa63e2c0998311cf39d5a9a6f70ac..d411615829e8c76e4bee2456c5fdd010613cecc1 100644 (file)
@@ -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<OSDOp>::iterator p = m->ops.begin(); p != m->ops.end(); ++p) {