1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_LIBRBD_MANAGED_LOCK_BREAK_REQUEST_H
5 #define CEPH_LIBRBD_MANAGED_LOCK_BREAK_REQUEST_H
7 #include "include/int_types.h"
8 #include "include/buffer.h"
9 #include "msg/msg_types.h"
12 #include <boost/optional.hpp>
13 #include "librbd/managed_lock/Types.h"
19 namespace librados { class IoCtx; }
24 template <typename> class Journal;
26 namespace managed_lock {
28 template <typename ImageCtxT = ImageCtx>
31 static BreakRequest* create(librados::IoCtx& ioctx, ContextWQ *work_queue,
32 const std::string& oid, const Locker &locker,
33 bool exclusive, bool blacklist_locker,
34 uint32_t blacklist_expire_seconds,
35 bool force_break_lock, Context *on_finish) {
36 return new BreakRequest(ioctx, work_queue, oid, locker, exclusive,
37 blacklist_locker, blacklist_expire_seconds,
38 force_break_lock, on_finish);
56 * BLACKLIST (skip if disabled)
67 librados::IoCtx &m_ioctx;
69 ContextWQ *m_work_queue;
73 bool m_blacklist_locker;
74 uint32_t m_blacklist_expire_seconds;
75 bool m_force_break_lock;
80 std::list<obj_watch_t> m_watchers;
81 int m_watchers_ret_val;
83 Locker m_refreshed_locker;
85 BreakRequest(librados::IoCtx& ioctx, ContextWQ *work_queue,
86 const std::string& oid, const Locker &locker,
87 bool exclusive, bool blacklist_locker,
88 uint32_t blacklist_expire_seconds, bool force_break_lock,
91 void send_get_watchers();
92 void handle_get_watchers(int r);
94 void send_get_locker();
95 void handle_get_locker(int r);
97 void send_blacklist();
98 void handle_blacklist(int r);
100 void send_break_lock();
101 void handle_break_lock(int r);
107 } // namespace managed_lock
108 } // namespace librbd
110 extern template class librbd::managed_lock::BreakRequest<librbd::ImageCtx>;
112 #endif // CEPH_LIBRBD_MANAGED_LOCK_BREAK_REQUEST_H