From a03d375ed030462dc68df9fa0cf501ef5fbe1ee2 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 17 Nov 2014 13:06:29 -0800 Subject: [PATCH] osd/ReplicatedPG: pass promote error to all blocked operations This isn't the most elegant strategy, but it is the best we can do right now. Signed-off-by: Sage Weil --- src/osd/ReplicatedPG.cc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index b67cd7644c3d..e51faade0507 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -6463,17 +6463,18 @@ void ReplicatedPG::finish_promote(int r, OpRequestRef op, } if (r < 0 && !whiteout) { - if (op) { - // we need to get rid of the op in the blocked queue - map >::iterator blocked_iter = - waiting_for_blocked_object.find(soid); - assert(blocked_iter != waiting_for_blocked_object.end()); - assert(blocked_iter->second.begin()->get() == op.get()); - blocked_iter->second.pop_front(); - if (blocked_iter->second.empty()) { - waiting_for_blocked_object.erase(blocked_iter); - } - osd->reply_op_error(op, r); + derr << __func__ << " unexpected promote error " << cpp_strerror(r) << dendl; + // pass error to everyone blocked on this object + // FIXME: this is pretty sloppy, but at this point we got + // something unexpected and don't have many other options. + map >::iterator blocked_iter = + waiting_for_blocked_object.find(soid); + if (blocked_iter != waiting_for_blocked_object.end()) { + while (!blocked_iter->second.empty()) { + osd->reply_op_error(blocked_iter->second.front(), r); + blocked_iter->second.pop_front(); + } + waiting_for_blocked_object.erase(blocked_iter); } return; } -- 2.47.3