From 1c40cfc82e0883b9a03ebee39bb020e2bfb49972 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Fri, 23 Aug 2019 14:52:28 -0400 Subject: [PATCH] rbd-nbd: shutdown should wait for pending IOs to complete Previously it was incorrectly waiting for finished IOs to complete. The finished IO would have already been cleared by the writer thread at this point. Any remaining pending or finished IOs implies a failure / shutdown of the NBD device. Fixes: https://tracker.ceph.com/issues/41409? Signed-off-by: Jason Dillaman --- src/tools/rbd_nbd/rbd-nbd.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/rbd_nbd/rbd-nbd.cc b/src/tools/rbd_nbd/rbd-nbd.cc index 1c56d73cb124..77d8e82e2997 100644 --- a/src/tools/rbd_nbd/rbd-nbd.cc +++ b/src/tools/rbd_nbd/rbd-nbd.cc @@ -227,7 +227,7 @@ private: { ceph_assert(!reader_thread.is_started()); std::unique_lock l{lock}; - cond.wait(l, [this] { return io_finished.empty(); }); + cond.wait(l, [this] { return io_pending.empty(); }); while(!io_finished.empty()) { std::unique_ptr free_ctx(io_finished.front()); -- 2.47.3