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_fwd.h"
9 #include "include/rados/librados_fwd.hpp"
10 #include "msg/msg_types.h"
13 #include <boost/optional.hpp>
14 #include "librbd/managed_lock/Types.h"
24 template <typename
> class Journal
;
25 namespace asio
{ struct ContextWQ
; }
27 namespace managed_lock
{
29 template <typename ImageCtxT
= ImageCtx
>
32 static BreakRequest
* create(librados::IoCtx
& ioctx
,
33 AsioEngine
& asio_engine
,
34 const std::string
& oid
, const Locker
&locker
,
35 bool exclusive
, bool blocklist_locker
,
36 uint32_t blocklist_expire_seconds
,
37 bool force_break_lock
, Context
*on_finish
) {
38 return new BreakRequest(ioctx
, asio_engine
, oid
, locker
, exclusive
,
39 blocklist_locker
, blocklist_expire_seconds
,
40 force_break_lock
, on_finish
);
58 * BLOCKLIST (skip if disabled)
72 librados::IoCtx
&m_ioctx
;
74 AsioEngine
& m_asio_engine
;
78 bool m_blocklist_locker
;
79 uint32_t m_blocklist_expire_seconds
;
80 bool m_force_break_lock
;
85 std::list
<obj_watch_t
> m_watchers
;
86 int m_watchers_ret_val
;
88 Locker m_refreshed_locker
;
90 BreakRequest(librados::IoCtx
& ioctx
, AsioEngine
& asio_engine
,
91 const std::string
& oid
, const Locker
&locker
,
92 bool exclusive
, bool blocklist_locker
,
93 uint32_t blocklist_expire_seconds
, bool force_break_lock
,
96 void send_get_watchers();
97 void handle_get_watchers(int r
);
99 void send_get_locker();
100 void handle_get_locker(int r
);
102 void send_blocklist();
103 void handle_blocklist(int r
);
105 void wait_for_osd_map();
106 void handle_wait_for_osd_map(int r
);
108 void send_break_lock();
109 void handle_break_lock(int r
);
115 } // namespace managed_lock
116 } // namespace librbd
118 extern template class librbd::managed_lock::BreakRequest
<librbd::ImageCtx
>;
120 #endif // CEPH_LIBRBD_MANAGED_LOCK_BREAK_REQUEST_H