]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd/migration/NBDStream: call nbd_shutdown() in close()
authorIlya Dryomov <idryomov@gmail.com>
Mon, 2 Sep 2024 20:21:23 +0000 (22:21 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 21 May 2025 15:27:16 +0000 (17:27 +0200)
Avoid warnings like

  qemu-nbd: Disconnect client, due to: Failed to read request:
  Unexpected end-of-file before all bytes were read

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit e1418e1975753bd3b5fbb7af88e361d3bbf7a1b6)

src/librbd/migration/NBDStream.cc

index c9eb618a24bfc3f4779ae388f899f80407b50dad..57b9b72ba38886293710aa8f8e4aa3f35301f8fa 100644 (file)
@@ -263,6 +263,12 @@ void NBDStream<I>::close(Context* on_finish) {
   ldout(m_cct, 20) << dendl;
 
   if (m_nbd != nullptr) {
+    // send a graceful shutdown to the server
+    // ignore errors -- we are read-only, also from the client's
+    // POV there is no disadvantage to abruptly closing the socket
+    // in nbd_close()
+    nbd_shutdown(m_nbd, 0);
+
     nbd_close(m_nbd);
     m_nbd = nullptr;
   }