<< dendl;
}
+ send_flush();
+}
+
+template <typename I>
+void CloseRequest<I>::send_flush() {
+ CephContext *cct = m_image_ctx->cct;
+ ldout(cct, 10) << this << " " << __func__ << dendl;
+
+ std::shared_lock owner_locker{m_image_ctx->owner_lock};
+ auto ctx = create_context_callback<
+ CloseRequest<I>, &CloseRequest<I>::handle_flush>(this);
+ auto aio_comp = io::AioCompletion::create_and_start(ctx, m_image_ctx,
+ io::AIO_TYPE_FLUSH);
+ auto req = io::ImageDispatchSpec<I>::create_flush(
+ *m_image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, aio_comp,
+ io::FLUSH_SOURCE_INTERNAL, {});
+ req->send();
+}
+
+template <typename I>
+void CloseRequest<I>::handle_flush(int r) {
+ CephContext *cct = m_image_ctx->cct;
+ ldout(cct, 10) << this << " " << __func__ << ": r=" << r << dendl;
+
+ if (r < 0) {
+ lderr(cct) << "failed to flush IO: " << cpp_strerror(r) << dendl;
+ }
+
send_shut_down_exclusive_lock();
}
}
if (m_exclusive_lock == nullptr) {
- send_flush();
+ send_unregister_image_watcher();
return;
}
send_unregister_image_watcher();
}
-template <typename I>
-void CloseRequest<I>::send_flush() {
- CephContext *cct = m_image_ctx->cct;
- ldout(cct, 10) << this << " " << __func__ << dendl;
-
- std::shared_lock owner_locker{m_image_ctx->owner_lock};
- auto ctx = create_context_callback<
- CloseRequest<I>, &CloseRequest<I>::handle_flush>(this);
- auto aio_comp = io::AioCompletion::create_and_start(ctx, m_image_ctx,
- io::AIO_TYPE_FLUSH);
- auto req = io::ImageDispatchSpec<I>::create_flush(
- *m_image_ctx, io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp,
- io::FLUSH_SOURCE_INTERNAL, {});
- req->send();
-}
-
-template <typename I>
-void CloseRequest<I>::handle_flush(int r) {
- CephContext *cct = m_image_ctx->cct;
- ldout(cct, 10) << this << " " << __func__ << ": r=" << r << dendl;
-
- if (r < 0) {
- lderr(cct) << "failed to flush IO: " << cpp_strerror(r) << dendl;
- }
- send_unregister_image_watcher();
-}
-
template <typename I>
void CloseRequest<I>::send_unregister_image_watcher() {
if (m_image_ctx->image_watcher == nullptr) {
* BLOCK_IMAGE_WATCHER (skip if R/O)
* |
* v
- * SHUT_DOWN_UPDATE_WATCHERS . .
- * | . (exclusive lock disabled)
- * v v
- * SHUT_DOWN_EXCLUSIVE_LOCK FLUSH
- * | .
- * | . . . . . . . . . . .
- * | .
- * v v
+ * SHUT_DOWN_UPDATE_WATCHERS
+ * |
+ * v
+ * FLUSH
+ * |
+ * v (skip if disabled)
+ * SHUT_DOWN_EXCLUSIVE_LOCK
+ * |
+ * v
* UNREGISTER_IMAGE_WATCHER (skip if R/O)
* |
* v
void send_shut_down_update_watchers();
void handle_shut_down_update_watchers(int r);
- void send_shut_down_exclusive_lock();
- void handle_shut_down_exclusive_lock(int r);
-
void send_flush();
void handle_flush(int r);
+ void send_shut_down_exclusive_lock();
+ void handle_shut_down_exclusive_lock(int r);
+
void send_unregister_image_watcher();
void handle_unregister_image_watcher(int r);