Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / librbd / exclusive_lock / AutomaticPolicy.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #include "librbd/exclusive_lock/AutomaticPolicy.h"
5 #include "librbd/ImageCtx.h"
6 #include "librbd/ExclusiveLock.h"
7
8 #define dout_subsys ceph_subsys_rbd
9 #undef dout_prefix
10 #define dout_prefix *_dout << "librbd::ExclusiveLock::AutomaticPolicy "
11
12 namespace librbd {
13 namespace exclusive_lock {
14
15 int AutomaticPolicy::lock_requested(bool force) {
16   assert(m_image_ctx->owner_lock.is_locked());
17   assert(m_image_ctx->exclusive_lock != nullptr);
18
19   ldout(m_image_ctx->cct, 20) << this << " " << __func__ << ": force=" << force
20                               << dendl;
21
22   // release the lock upon request (ignore forced requests)
23   m_image_ctx->exclusive_lock->release_lock(nullptr);
24   return 0;
25 }
26
27 } // namespace exclusive_lock
28 } // namespace librbd
29