Open the device read-only in vitastor-nbd unmap #162

Merged
vitalif merged 1 commits from koolkhel/vitastor:nbd-unmap-rdonly into master 2026-11-27 13:55:08 +03:00

View File

@@ -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");