Skip to content

Commit

Permalink
ReplicatedPG: test for missing head before find_object_context
Browse files Browse the repository at this point in the history
find_object_context doesn't return EAGAIN for a missing head.
I chose not to change that behavior since it might hide bugs
in the future.  All other callers check for missing on head
before calling into find_object_context because we potentially
need head or snapdir to map a snapid onto a clone.

Backport: emperor
Fixes: 6758
Signed-off-by: Samuel Just <[email protected]>
Reviewed-by: Josh Durgin <[email protected]>
Reviewed-by: David Zafman <[email protected]>
  • Loading branch information
Samuel Just committed Nov 14, 2013
1 parent d8d27f1 commit dd9d8b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/common/hobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 5 additions & 2 deletions src/osd/ReplicatedPG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit dd9d8b0

Please sign in to comment.