klass, &klass::handle_block_writes>(this);
{
- RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
+ std::shared_lock owner_locker{m_image_ctx.owner_lock};
// setting the lock as required will automatically cause the IO
// queue to re-request the lock if any IO is queued
if (m_image_ctx.clone_copy_on_read ||
CephContext *cct = m_image_ctx.cct;
ldout(cct, 10) << dendl;
- RWLock::RLocker owner_lock(m_image_ctx.owner_lock);
+ std::shared_lock owner_lock{m_image_ctx.owner_lock};
Context *ctx = create_context_callback<
PreReleaseRequest<I>,
&PreReleaseRequest<I>::handle_invalidate_cache>(this);
template <typename I>
void PreReleaseRequest<I>::send_close_journal() {
{
- RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+ std::unique_lock image_locker{m_image_ctx.image_lock};
std::swap(m_journal, m_image_ctx.journal);
}
lderr(cct) << "failed to close journal: " << cpp_strerror(r) << dendl;
}
- delete m_journal;
+ m_journal->put();
+ m_journal = nullptr;
send_close_object_map();
}
template <typename I>
void PreReleaseRequest<I>::send_close_object_map() {
{
- RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+ std::unique_lock image_locker{m_image_ctx.image_lock};
std::swap(m_object_map, m_image_ctx.object_map);
}
using klass = PreReleaseRequest<I>;
Context *ctx = create_context_callback<
- klass, &klass::handle_close_object_map>(this);
+ klass, &klass::handle_close_object_map>(this, m_object_map);
m_object_map->close(ctx);
}
if (r < 0) {
lderr(cct) << "failed to close object map: " << cpp_strerror(r) << dendl;
}
+ m_object_map->put();
- delete m_object_map;
send_unlock();
}