]> git.apps.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.
authorPan Liu <pan.liu@istuary.com>
Sat, 11 Mar 2017 13:50:00 +0000 (21:50 +0800)
committerNathan Cutler <ncutler@suse.com>
Sat, 3 Feb 2018 20:48:07 +0000 (21:48 +0100)
Signed-off-by: Pan Liu <liupan1111@gmail.com>
(cherry picked from commit 37aa18858b38cee61e122adc0a1834ca797ea84f)

src/tools/rbd_nbd/rbd-nbd.cc

index 88e1e0ff658359aefb517dff6c7fd743f66d2472..f9115a9e5dd312e1eb52a99a410887044fd3e820 100644 (file)
@@ -557,10 +557,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;