mirror of
https://github.com/ceph/ceph
synced 2025-03-08 01:10:10 +00:00
librbd: fix ImageWatcher::is_lock_supported() locking
Take snap_lock while reading ImageCtx->snap_id, and look up the features by snap_id as well. Signed-off-by: Josh Durgin <jdurgin@redhat.com>
This commit is contained in:
parent
a94ceb6088
commit
4bcbdbfd0f
@ -67,7 +67,10 @@ ImageWatcher::~ImageWatcher()
|
||||
|
||||
bool ImageWatcher::is_lock_supported() const {
|
||||
assert(m_image_ctx.owner_lock.is_locked());
|
||||
return ((m_image_ctx.features & RBD_FEATURE_EXCLUSIVE_LOCK) != 0 &&
|
||||
RWLock::RLocker l(m_image_ctx.snap_lock);
|
||||
uint64_t snap_features;
|
||||
m_image_ctx.get_features(m_image_ctx.snap_id, &snap_features);
|
||||
return ((snap_features & RBD_FEATURE_EXCLUSIVE_LOCK) != 0 &&
|
||||
!m_image_ctx.read_only && m_image_ctx.snap_id == CEPH_NOSNAP);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user