From: Mykola Golub Date: Wed, 15 Jun 2016 08:31:14 +0000 (+0300) Subject: librbd: re-register watch on old format image rename X-Git-Tag: v11.0.0~73^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1a3973c8814200dc449a557a4fc8212911633985;p=ceph.git 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 --- diff --git a/src/librbd/Operations.cc b/src/librbd/Operations.cc index f19ebf2b8911..7769f97f9839 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);