From: Mykola Golub Date: Fri, 4 Dec 2020 10:50:33 +0000 (+0000) Subject: librbd: flush task finisher queue on unregistering watcher X-Git-Tag: v16.1.0~375^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f957e29b10672b63bdf827ea18d73ca99cffa664;p=ceph.git librbd: flush task finisher queue on unregistering watcher To make sure all inflight requests like scheduled cancel_async_requests are complete on shutdown. Signed-off-by: Mykola Golub --- diff --git a/src/librbd/ImageWatcher.cc b/src/librbd/ImageWatcher.cc index 15155b745491..b2f9d610d7d2 100644 --- a/src/librbd/ImageWatcher.cc +++ b/src/librbd/ImageWatcher.cc @@ -88,6 +88,9 @@ void ImageWatcher::unregister_watch(Context *on_finish) { cancel_async_requests(); + // flush the task finisher queue before completing + on_finish = create_async_context_callback(m_task_finisher, on_finish); + on_finish = new LambdaContext([this, on_finish](int r) { cancel_quiesce_requests(); m_task_finisher->cancel_all();