Report netlink-map failures in its exit status #121
Reference in New Issue
Block a user
No description provided.
Delete Branch "koolkhel/vitastor:nbd-netlink-map-status"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
netlink-mapandnetlink-reviveforked before configuring the device, and the parent exited 0 at once. So a failed configuration (a busy device, no permission, no nbd netlink family) still returned 0, and the command could return before the device was set up.Both map modes now fork once, before setting up the device, the way
vitastor-ublkdoes.daemonize_fork(int *notifyfd)keeps the parent until the daemon sends the device number. The parent then prints/dev/nbdNand exits 0, or exits 1 if the daemon dies first.daemonize()is gone. In the ioctlmap, the setup child no longer forks on its own, because the daemon is already detached. Failed tries on busy devices are reaped, andmap /dev/nbdNnow prints the device too.Tested as root against a local 3-OSD cluster (
tests/run_3osds.sh):map(auto and explicit),map --foregroundandnetlink-mapexit 0, print the device, and I/O works. A resize reaches the ioctl devices.mapandnetlink-maponto a busy device exit 1 with the error and print nothing, and so doesnetlink-map --foreground. Before the change,netlink-maponto a busy device exited 0.unmapornetlink-unmap, the daemon exits within a second.tests/test_img_online_resize.shnow checks thatnetlink-maponto its busy nbd device doesn't exit 0. That check fails without this change.Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA
@@ -825,6 +829,41 @@ help:exit(0);}// Like daemonize_fork(), but the parent prints the device and exits 0 onlyЕсли хочется такое сделать, нужно скопипастить с ublk_server, там по идее такая же штука реализована уже, не нужно чтобы в двух файлах было 2 разных реализации примерно одного и того же, и также не надо чтобы было аж 4 функции - daemonize_fork, daemonize_reopen_stdio, daemonize_begin, daemonize_end
d17688e154toca6aee9d77