if (!op->may_write() && !obc->obs.exists) {
osd->reply_op_error(op, -ENOENT);
- put_object_context(obc);
return;
}
dout(10) << "do_op writes for " << obc->obs.oi.soid << " blocked by "
<< obc->blocked_by->obs.oi.soid << dendl;
wait_for_degraded_object(obc->blocked_by->obs.oi.soid, op);
- put_object_context(obc);
return;
}
if (osd_op.op.op == CEPH_OSD_OP_LIST_SNAPS &&
m->get_snapid() != CEPH_SNAPDIR) {
dout(10) << "LIST_SNAPS with incorrect context" << dendl;
- put_object_context(obc);
osd->reply_op_error(op, -EINVAL);
return;
}
(before_backfill && sobc->obs.oi.soid > backfill_target_info->last_backfill)) {
wait_for_degraded_object(sobc->obs.oi.soid, op);
dout(10) << " writes for " << obc->obs.oi.soid << " now blocked by "
- << sobc->obs.oi.soid << dendl;
- obc->get();
+ << sobc->obs.oi.soid << dendl;
obc->blocked_by = sobc;
- sobc->get();
sobc->blocking.insert(obc);
} else {
dout(10) << " src_oid " << src_oid << " obc " << src_obc << dendl;
dout(10) << "no src oid specified for multi op " << osd_op << dendl;
osd->reply_op_error(op, -EINVAL);
}
- put_object_contexts(src_obc);
- put_object_context(obc);
+ src_obc.clear();
return;
}
src_obc[clone_oid] = sobc;
continue;
}
- put_object_contexts(src_obc);
- put_object_context(obc);
+ src_obc.clear();
return;
} else {
continue;
<< " < snapset seq " << obc->ssc->snapset.seq
<< " on " << soid << dendl;
delete ctx;
- put_object_context(obc);
- put_object_contexts(src_obc);
+ src_obc.clear();
osd->reply_op_error(op, -EOLDSNAPC);
return;
}
if (oldv != eversion_t()) {
dout(3) << "do_op dup " << ctx->reqid << " was " << oldv << dendl;
delete ctx;
- put_object_context(obc);
- put_object_contexts(src_obc);
+ src_obc.clear();
if (already_complete(oldv)) {
osd->reply_op_error(op, 0, oldv);
} else {
if (result == -EAGAIN) {
// clean up after the ctx
delete ctx;
- put_object_context(obc);
- put_object_contexts(src_obc);
+ src_obc.clear();
return;
}
if (ctx->delta_stats.num_bytes > 0 &&
pool.info.get_flags() & pg_pool_t::FLAG_FULL) {
delete ctx;
- put_object_context(obc);
- put_object_contexts(src_obc);
+ src_obc.clear();
osd->reply_op_error(op, -ENOSPC);
return;
}
reply->add_flags(CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK);
osd->send_message_osd_client(reply, m->get_connection());
delete ctx;
- put_object_context(obc);
- put_object_contexts(src_obc);
+ src_obc.clear();
return;
}
append_log(ctx->log, pg_trim_to, ctx->local_t);
- // continuing on to write path, make sure object context is registered
- assert(obc->registered);
-
// verify that we are doing this in order?
if (g_conf->osd_debug_op_order && m->get_source().is_client()) {
map<client_t,tid_t>& cm = debug_op_order[obc->obs.oi.soid];
assert(0);
}
assert(r == 0);
- assert(obc->registered);
object_info_t &coi = obc->obs.oi;
set<snapid_t> old_snaps(coi.snaps.begin(), coi.snaps.end());
snapset.head_exists ? CEPH_NOSNAP:CEPH_SNAPDIR, coid.hash,
info.pgid.pool(), coid.get_namespace());
ctx->snapset_obc = get_object_context(snapoid, false);
- assert(ctx->snapset_obc->registered);
if (snapset.clones.empty() && !snapset.head_exists) {
dout(10) << coid << " removing " << snapoid << dendl;
t.nop(); // make sure update the object_info on disk!
}
ctx->watch_connects.push_back(w);
- assert(obc->registered);
} else {
map<pair<uint64_t, entity_name_t>, watch_info_t>::iterator oi_iter =
oi.watchers.find(make_pair(cookie, entity));
obs.oi.size = rollback_to->obs.oi.size;
snapset.head_exists = true;
}
- put_object_context(rollback_to);
}
return ret;
}
if (is_primary()) {
ctx->clone_obc = new ObjectContext(static_snap_oi, true, NULL);
ctx->clone_obc->get();
- register_object_context(ctx->clone_obc);
snap_oi = &ctx->clone_obc->obs.oi;
} else {
snap_oi = &static_snap_oi;
ctx->at_version.version++;
ctx->snapset_obc->obs.exists = false;
- assert(ctx->snapset_obc->registered);
}
}
} else if (ctx->new_snapset.clones.size()) {
ctx->snapset_obc->obs.oi.version = ctx->at_version;
ctx->snapset_obc->obs.oi.last_reqid = ctx->reqid;
ctx->snapset_obc->obs.oi.mtime = ctx->mtime;
- assert(ctx->snapset_obc->registered);
bufferlist bv(sizeof(ctx->new_obs.oi));
::encode(ctx->snapset_obc->obs.oi, bv);
int whoami = osd->get_nodeid();
if (repop->ctx->clone_obc) {
- put_object_context(repop->ctx->clone_obc);
repop->ctx->clone_obc = ObjectContextRef();
}
if (repop->ctx->snapset_obc) {
repop->ctx->snapset_obc = ObjectContextRef();
}
- put_object_context(repop->obc);
- put_object_contexts(repop->src_obc);
repop->src_obc.clear();
repop->obc = ObjectContextRef();
++i) {
i->second->get();
get_obc_watchers(i->second, pg_watchers);
- put_object_context(i->second);
}
}
++i) {
i->second->get();
check_blacklisted_obc_watchers(i->second);
- put_object_context(i->second);
}
}
dout(10) << "handle_watch_timeout waiting for degraded on obj "
<< obc->obs.oi.soid
<< dendl;
- put_object_context(obc); // callback got its own ref
return;
}
scrubber.add_callback(
watch->get_delayed_cb() // This callback!
);
- put_object_context(obc);
return;
}
{
ObjectContext *obc = new ObjectContext(oi, false, ssc);
dout(10) << "create_object_context " << obc << " " << oi.soid << " " << obc->ref << dendl;
- register_object_context(obc);
populate_obc_watchers(obc);
- obc->ref++;
return obc;
}
obc = new ObjectContext(oi, true, ssc);
obc->obs.exists = true;
- register_object_context(obc);
if (can_create && !obc->ssc)
obc->ssc = get_snapset_context(soid.oid, soid.get_key(), soid.hash, true, soid.get_namespace());
populate_obc_watchers(obc);
dout(10) << "get_object_context " << obc << " " << soid << " 0 -> 1 read " << obc->obs.oi << dendl;
}
- obc->ref++;
return obc;
}
for (list<ObjectContext *>::iterator i = contexts.begin();
i != contexts.end();
contexts.erase(i++)) {
- put_object_context(*i);
}
}
ObjectContextRef obc = get_object_context(head, can_create);
if (obc && !obc->obs.exists) {
// ignore it if the obc exists but the object doesn't
- put_object_context(obc);
obc = ObjectContextRef();
}
if (!obc) {
} else {
dout(20) << "find_object_context " << soid << " [" << first << "," << last
<< "] does not contain " << oid.snap << " -- DNE" << dendl;
- put_object_context(obc);
return -ENOENT;
}
}
-void ReplicatedPG::put_object_context(ObjectContext *obc)
-{
- dout(10) << "put_object_context " << obc << " " << obc->obs.oi.soid << " "
- << obc->ref << " -> " << (obc->ref-1) << dendl;
-
- --obc->ref;
- if (obc->ref == 0) {
- if (obc->ssc)
- put_snapset_context(obc->ssc);
-
- if (obc->registered)
- object_contexts.erase(obc->obs.oi.soid);
- delete obc;
- }
-}
-
-void ReplicatedPG::put_object_contexts(map<hobject_t,ObjectContext*>& obcv)
-{
- if (obcv.empty())
- return;
- dout(10) << "put_object_contexts " << obcv << dendl;
- for (map<hobject_t,ObjectContext*>::iterator p = obcv.begin(); p != obcv.end(); ++p)
- put_object_context(p->second);
- obcv.clear();
-}
-
void ReplicatedPG::add_object_context_to_pg_stat(ObjectContext *obc, pg_stat_t *pgstat)
{
object_info_t& oi = obc->obs.oi;
i->second->blocking.erase(j++)) {
dout(10) << " no longer blocking writes for " << (*j)->obs.oi.soid << dendl;
(*j)->blocked_by = ObjectContextRef();
- put_object_context(*j);
- put_object_context(i->second);
}
- put_object_context(i->second);
}
if (callbacks_for_degraded_object.count(oid)) {
list<Context*> contexts;
{
lock();
dout(10) << "_applied_recovered_object " << *obc << dendl;
- put_object_context(obc);
assert(active_pushes >= 1);
--active_pushes;
requeue_ops(waiting_for_all_missing);
waiting_for_all_missing.clear();
- while (!obcs.empty()) {
- ObjectContext *obc = obcs.front();
- put_object_context(obc);
- obcs.pop_front();
- }
+ obcs.clear();
unlock();
}
dout(10) << " ondisk_read_unlock on " << soid << dendl;
obc->ondisk_read_unlock();
- put_object_context(obc);
return 1;
}
pg_stat_t stat;
add_object_context_to_pg_stat(obc, &stat);
pending_backfill_updates[*i] = stat;
- put_object_context(obc);
}
for (map<hobject_t, eversion_t>::iterator i = to_remove.begin();
i != to_remove.end();
prep_push_to_replica(obc, oid, peer, g_conf->osd_recovery_op_priority,
&((*pushes)[peer].back()));
obc->ondisk_read_unlock();
- put_object_context(obc);
}
void ReplicatedPG::scan_range(