From 1a3973c8814200dc449a557a4fc8212911633985 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Wed, 15 Jun 2016 11:31:14 +0300 Subject: [PATCH] librbd: re-register watch on old format image rename The watching object name is changed when renaming an old format image, so unregister the watcher before the rename, and register back after, to avoid "Transport endpoint is not connected" error. Fixes: http://tracker.ceph.com/issues/16321 Signed-off-by: Mykola Golub --- src/librbd/Operations.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/librbd/Operations.cc b/src/librbd/Operations.cc index f19ebf2b891..7769f97f983 100644 --- a/src/librbd/Operations.cc +++ b/src/librbd/Operations.cc @@ -534,7 +534,18 @@ void Operations::execute_rename(const char *dstname, Context *on_finish) { << dendl; if (m_image_ctx.old_format) { + // unregister watch before and register back after rename on_finish = new C_NotifyUpdate(m_image_ctx, on_finish); + on_finish = new FunctionContext([this, on_finish](int r) { + m_image_ctx.image_watcher->register_watch(on_finish); + }); + on_finish = new FunctionContext([this, dstname, on_finish](int r) { + operation::RenameRequest *req = new operation::RenameRequest( + m_image_ctx, on_finish, dstname); + req->send(); + }); + m_image_ctx.image_watcher->unregister_watch(on_finish); + return; } operation::RenameRequest *req = new operation::RenameRequest( m_image_ctx, on_finish, dstname); -- 2.39.5