]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-nbd: only try to load nbd module once when open nbd device, during do_map operation. 13694/head
authorPan Liu <pan.liu@istuary.com>
Sat, 11 Mar 2017 13:50:00 +0000 (21:50 +0800)
committerPan Liu <pan.liu@istuary.com>
Sat, 11 Mar 2017 13:50:00 +0000 (21:50 +0800)
Signed-off-by: Pan Liu <liupan1111@gmail.com>
src/tools/rbd_nbd/rbd-nbd.cc

index c09623708363ec366957509154b1d960864ee818..71f3ba080438b7c411434548a76455db7b87e011 100644 (file)
@@ -562,10 +562,12 @@ static int do_map(int argc, const char *argv[])
 
   if (devpath.empty()) {
     char dev[64];
+    bool try_load_module = true;
     while (true) {
       snprintf(dev, sizeof(dev), "/dev/nbd%d", index);
 
-      nbd = open_device(dev, true);
+      nbd = open_device(dev, try_load_module);
+      try_load_module = false;
       if (nbd < 0) {
         r = nbd;
         cerr << "rbd-nbd: failed to find unused device" << std::endl;