nbd-proxy: listen for udev change event before running start hook
Currently, we run the start state-change hook as soon as the nbd session
has been established. However, at that point the nbd device isn't
connected, as we haven't processed any read/write operations on the
block device.
This change defers running the start script until we know that the
device is initialised - when we see a udev change event occur. To do
this, we establish a udev monitor.
Once we see that state change, we run the state change hooks and shut
down the udev monitor.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
3 files changed