diff --git a/src/common/hobject.h b/src/common/hobject.h index 3c2202df4b1b5..4081ceb8f8523 100644 --- a/src/common/hobject.h +++ b/src/common/hobject.h @@ -98,6 +98,11 @@ struct hobject_t { return ret; } + /// @return true if object is head + bool is_head() const { + return snap == CEPH_NOSNAP; + } + /// @return true if object is neither head nor snapdir bool is_snap() const { return (snap != CEPH_NOSNAP) && (snap != CEPH_SNAPDIR); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index e82331738bef9..57d9ec72bbd42 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1046,9 +1046,12 @@ void ReplicatedPG::do_op(OpRequestRef op) if (!src_obc.count(src_oid)) { ObjectContextRef sobc; snapid_t ssnapid; + int r; - int r = find_object_context(src_oid, &sobc, false, &ssnapid); - if (r == -EAGAIN) { + if (src_oid.is_head() && is_missing_object(src_oid)) { + wait_for_missing_object(src_oid, op); + } else if ((r = find_object_context( + src_oid, &sobc, false, &ssnapid)) == -EAGAIN) { // missing the specific snap we need; requeue and wait. hobject_t wait_oid(osd_op.soid.oid, src_oloc.key, ssnapid, m->get_pg().ps(), info.pgid.pool(), m->get_object_locator().nspace);