rbd-nbd: only try to load nbd module once when open nbd device, during do_map operation.

Signed-off-by: Pan Liu <liupan1111@gmail.com>
This commit is contained in:
Pan Liu 2017-03-11 21:50:00 +08:00
parent 58a273d194
commit 37aa18858b

View 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;