From: Pan Liu Date: Tue, 28 Mar 2017 08:48:21 +0000 (+0800) Subject: rbd-nbd: polish the output info before and after ioctl NBD_DISCONNECT. X-Git-Tag: v11.2.1~101^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4d310c24af51bb0539426a5a7ca6f2b1ca31a1d0;p=ceph.git rbd-nbd: polish the output info before and after ioctl NBD_DISCONNECT. Signed-off-by: Pan Liu (cherry picked from commit ff4dcf029028e8a3636ac71a6c5ac5380bf274e4) --- diff --git a/src/tools/rbd_nbd/rbd-nbd.cc b/src/tools/rbd_nbd/rbd-nbd.cc index 047f3e5c0ed..c87ba051a56 100644 --- a/src/tools/rbd_nbd/rbd-nbd.cc +++ b/src/tools/rbd_nbd/rbd-nbd.cc @@ -91,7 +91,12 @@ static void handle_signal(int signum) { assert(signum == SIGINT || signum == SIGTERM); derr << "*** Got signal " << sig_str(signum) << " ***" << dendl; - ioctl(nbd, NBD_DISCONNECT); + dout(20) << __func__ << ": " << "sending NBD_DISCONNECT" << dendl; + if (ioctl(nbd, NBD_DISCONNECT) < 0) { + derr << "rbd-nbd: disconnect failed: " << cpp_error(errno) << std::endl; + } else { + dout(20) << __func__ << ": " << "disconnected" << dendl; + } } class NBDServer @@ -702,10 +707,13 @@ static int do_unmap() return nbd; } - // alert the reader thread to shut down + dout(20) << __func__ << ": " << "sending NBD_DISCONNECT" << dendl; if (ioctl(nbd, NBD_DISCONNECT) < 0) { cerr << "rbd-nbd: the device is not used" << std::endl; + } else { + dout(20) << __func__ << ": " << "disconnected" << dendl; } + close(nbd); return 0;