boost::optional<uint8_t> current_state;
pre_object_map_update(&new_state);
- m_state = LIBRBD_AIO_WRITE_PRE;
+ m_state = LIBRBD_AIO_WRITE_PRE;
FunctionContext *ctx = new FunctionContext(
boost::bind(&AioRequest::complete, this, _1));
if (!m_ictx->object_map.aio_update(m_object_no, new_state,
current_state, ctx)) {
// no object map update required
+ delete ctx;
return false;
}
}
}
-
+
if (lost_exclusive_lock) {
complete(-ERESTART);
}
if (!m_ictx->object_map.aio_update(m_object_no, OBJECT_NONEXISTENT,
OBJECT_PENDING, ctx)) {
// no object map update required
+ delete ctx;
return true;
}
- return false;
- }
+ return false;
+ }
void AbstractWrite::send_write() {
ldout(m_ictx->cct, 20) << "send_write " << this << " " << m_oid << " "
lost_exclusive_lock = true;
} else {
// flag the objects as pending deletion
+ Context *ctx = create_callback_context();
if (!m_image_ctx.object_map.aio_update(m_delete_start, m_num_objects,
- OBJECT_PENDING, OBJECT_EXISTS,
- create_callback_context())) {
+ OBJECT_PENDING, OBJECT_EXISTS,
+ ctx)) {
+ delete ctx;
remove_objects = true;
}
}
ldout(m_image_ctx.cct, 1) << "lost exclusive lock during trim" << dendl;
} else {
// flag the pending objects as removed
+ Context *ctx = create_callback_context();
if (!m_image_ctx.object_map.aio_update(m_delete_start, m_num_objects,
- OBJECT_NONEXISTENT,
- OBJECT_PENDING,
- create_callback_context())) {
+ OBJECT_NONEXISTENT,
+ OBJECT_PENDING, ctx)) {
+ delete ctx;
clean_boundary = true;
}
}
return true;
} else {
m_state = STATE_OBJECT_MAP;
+ Context *ctx = create_callback_context();
if (!m_ictx->object_map.aio_update(m_object_no, OBJECT_EXISTS,
- boost::optional<uint8_t>(),
- create_callback_context())) {
+ boost::optional<uint8_t>(), ctx)) {
+ delete ctx;
copyup = true;
}
}