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>
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) {