]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-nbd: fix kernel deadlock during teuthology testing
authorJason Dillaman <dillaman@redhat.com>
Mon, 5 Sep 2016 14:01:45 +0000 (10:01 -0400)
committerLoic Dachary <ldachary@redhat.com>
Fri, 21 Oct 2016 10:16:44 +0000 (12:16 +0200)
Fixes: http://tracker.ceph.com/issues/16921
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit ce7c1520a8019f011fa34dd898af317f78974577)

src/tools/rbd_nbd/rbd-nbd.cc

index 4b014dd7984ebc2356883315af5d05c785dd10fa..d6dae2073f69a0be5f924f527b2ff1af2c264d11 100644 (file)
@@ -235,6 +235,7 @@ private:
       switch (ctx->command)
       {
         case NBD_CMD_DISC:
+          // RBD_DO_IT will return when pipe is closed
          dout(0) << "disconnect request received" << dendl;
           return;
         case NBD_CMD_WRITE:
@@ -649,9 +650,10 @@ static int do_unmap()
     return nbd;
   }
 
-  if (ioctl(nbd, NBD_DISCONNECT) < 0)
+  // alert the reader thread to shut down
+  if (ioctl(nbd, NBD_DISCONNECT) < 0) {
     cerr << "rbd-nbd: the device is not used" << std::endl;
-  ioctl(nbd, NBD_CLEAR_SOCK);
+  }
   close(nbd);
 
   return 0;
@@ -726,6 +728,7 @@ static int rbd_nbd(int argc, const char *argv[])
   env_to_vec(args);
   global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_DAEMON,
               CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS);
+  g_ceph_context->_conf->set_val_or_die("pid_file", "");
 
   std::vector<const char*>::iterator i;
   std::ostringstream err;