diff --git a/src/client/nbd_proxy.cpp b/src/client/nbd_proxy.cpp index 26b6c6f9..cd247cbe 100644 --- a/src/client/nbd_proxy.cpp +++ b/src/client/nbd_proxy.cpp @@ -505,7 +505,8 @@ help: } // Run unmap snprintf(path, sizeof(path), "/dev/nbd%d", dev_num); - int r, nbd = open(path, O_RDWR); + // Not O_RDWR: closing a writable descriptor makes udev rescan the device + int r, nbd = open(path, O_RDONLY); if (nbd < 0) { perror("open");