Skip to content

Commit

Permalink
Merge pull request ceph#5146 from ceph/wip-12215-next
Browse files Browse the repository at this point in the history
librbd: don't attempt to invalidate an object map in R/O mode

Reviewed-by: Josh Durgin <[email protected]>
  • Loading branch information
jdurgin committed Jul 6, 2015
2 parents a22f9ed + 64d740f commit dea73c1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/librbd/ObjectMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ void ObjectMap::aio_resize(uint64_t new_size, uint8_t default_object_state,
Context *on_finish) {
assert(m_image_ctx.test_features(RBD_FEATURE_OBJECT_MAP));
assert(m_image_ctx.owner_lock.is_locked());
assert(m_image_ctx.image_watcher != NULL);
assert(!m_image_ctx.image_watcher->is_lock_supported() ||
m_image_ctx.image_watcher->is_lock_owner());

Expand All @@ -453,6 +454,7 @@ bool ObjectMap::aio_update(uint64_t start_object_no, uint64_t end_object_no,
assert(m_image_ctx.snap_lock.is_locked());
assert((m_image_ctx.features & RBD_FEATURE_OBJECT_MAP) != 0);
assert(m_image_ctx.owner_lock.is_locked());
assert(m_image_ctx.image_watcher != NULL);
assert(!m_image_ctx.image_watcher->is_lock_supported(m_image_ctx.snap_lock) ||
m_image_ctx.image_watcher->is_lock_owner());
assert(m_image_ctx.object_map_lock.is_wlocked());
Expand Down Expand Up @@ -518,8 +520,9 @@ void ObjectMap::invalidate(uint64_t snap_id) {
}

// do not update on-disk flags if not image owner
if (m_image_ctx.image_watcher->is_lock_supported(m_image_ctx.snap_lock) &&
!m_image_ctx.image_watcher->is_lock_owner()) {
if (m_image_ctx.image_watcher == NULL ||
(m_image_ctx.image_watcher->is_lock_supported(m_image_ctx.snap_lock) &&
!m_image_ctx.image_watcher->is_lock_owner())) {
return;
}

Expand Down

0 comments on commit dea73c1

Please sign in to comment.