CephContext *cct = ictx->cct;
ldout(cct, 20) << __func__ << ": ictx=" << ictx << dendl;
- if (!ictx->test_features(RBD_FEATURE_EXCLUSIVE_LOCK)) {
- lderr(cct) << "exclusive-lock feature is not enabled" << dendl;
- return -EINVAL;
- }
-
managed_lock::Locker locker;
C_SaferCond get_owner_ctx;
- ExclusiveLock<>(*ictx).get_locker(&locker, &get_owner_ctx);
+ {
+ std::shared_lock owner_locker{ictx->owner_lock};
+
+ if (ictx->exclusive_lock == nullptr) {
+ lderr(cct) << "exclusive-lock feature is not enabled" << dendl;
+ return -EINVAL;
+ }
+
+ ictx->exclusive_lock->get_locker(&locker, &get_owner_ctx);
+ }
+
int r = get_owner_ctx.wait();
if (r == -ENOENT) {
return r;