diff options
Diffstat (limited to 'src/osd/ReplicatedPG.cc')
-rw-r--r-- | src/osd/ReplicatedPG.cc | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 1684fa0dc53..f097b1c34c7 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -988,21 +988,9 @@ void ReplicatedPG::do_op(OpRequestRef op) return; } - if ((op->may_read()) && (obc->obs.oi.lost)) { - // This object is lost. Reading from it returns an error. - dout(20) << __func__ << ": object " << obc->obs.oi.soid - << " is lost" << dendl; - osd->reply_op_error(op, -ENFILE); - return; - } dout(25) << __func__ << ": object " << obc->obs.oi.soid << " has oi of " << obc->obs.oi << dendl; - if (!op->may_write() && !obc->obs.exists) { - osd->reply_op_error(op, -ENOENT); - return; - } - // are writes blocked by another object? if (obc->blocked_by) { dout(10) << "do_op writes for " << obc->obs.oi.soid << " blocked by " @@ -1121,11 +1109,30 @@ void ReplicatedPG::do_op(OpRequestRef op) } } - op->mark_started(); - OpContext *ctx = new OpContext(op, m->get_reqid(), m->ops, &obc->obs, obc->ssc, this); + if (!get_rw_locks(ctx)) { + op->mark_delayed("waiting for rw locks"); + close_op_ctx(ctx); + return; + } + + if ((op->may_read()) && (obc->obs.oi.lost)) { + // This object is lost. Reading from it returns an error. + dout(20) << __func__ << ": object " << obc->obs.oi.soid + << " is lost" << dendl; + close_op_ctx(ctx); + osd->reply_op_error(op, -ENFILE); + return; + } + if (!op->may_write() && !obc->obs.exists) { + close_op_ctx(ctx); + osd->reply_op_error(op, -ENOENT); + return; + } + + op->mark_started(); ctx->obc = obc; ctx->src_obc = src_obc; @@ -1202,7 +1209,7 @@ void ReplicatedPG::execute_ctx(OpContext *ctx) if (already_complete(oldv)) { reply_ctx(ctx, 0, oldv, entry->user_version); } else { - delete ctx; + close_op_ctx(ctx); if (m->wants_ack()) { if (already_ack(oldv)) { @@ -1295,7 +1302,7 @@ void ReplicatedPG::execute_ctx(OpContext *ctx) if (result == -EAGAIN) { // clean up after the ctx - delete ctx; + close_op_ctx(ctx); return; } @@ -1347,7 +1354,7 @@ void ReplicatedPG::execute_ctx(OpContext *ctx) reply->add_flags(CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK); osd->send_message_osd_client(reply, m->get_connection()); - delete ctx; + close_op_ctx(ctx); return; } @@ -1395,13 +1402,13 @@ void ReplicatedPG::execute_ctx(OpContext *ctx) void ReplicatedPG::reply_ctx(OpContext *ctx, int r) { osd->reply_op_error(ctx->op, r); - delete ctx; + close_op_ctx(ctx); } void ReplicatedPG::reply_ctx(OpContext *ctx, int r, eversion_t v, version_t uv) { osd->reply_op_error(ctx->op, r, v, uv); - delete ctx; + close_op_ctx(ctx); } void ReplicatedPG::log_op_stats(OpContext *ctx) @@ -4589,7 +4596,7 @@ void ReplicatedPG::cancel_copy(CopyOpRef cop) kick_object_context_blocked(ctx->obc); - delete ctx; + close_op_ctx(ctx); } void ReplicatedPG::cancel_copy_ops() @@ -4754,6 +4761,8 @@ void ReplicatedPG::op_commit(RepGather *repop) eval_repop(repop); } + release_op_ctx_locks(repop->ctx); + repop->put(); unlock(); } @@ -4996,6 +5005,7 @@ ReplicatedPG::RepGather *ReplicatedPG::new_repop(OpContext *ctx, ObjectContextRe void ReplicatedPG::remove_repop(RepGather *repop) { + release_op_ctx_locks(repop->ctx); repop_map.erase(repop->rep_tid); repop->put(); @@ -8238,7 +8248,12 @@ void ReplicatedPG::scan_range( { assert(is_locked()); dout(10) << "scan_range from " << bi->begin << dendl; - bi->version = last_update_applied; + if (last_update_applied >= info.log_tail) { + bi->version = last_update_applied; + } else { + osr.flush(); + bi->version = info.last_update; + } bi->objects.clear(); // for good measure vector<hobject_t> ls; |