• Markus Pargmann's avatar
    nbd: Create size change events for userspace · 37091fdd
    Markus Pargmann authored
    The userspace needs to know when nbd devices are ready for use.
    Currently no events are created for the userspace which doesn't work for
    systemd.
    
    See the discussion here: https://github.com/systemd/systemd/pull/358
    
    This patch uses a central point to setup the nbd-internal sizes. A ioctl
    to set a size does not lead to a visible size change. The size of the
    block device will be kept at 0 until nbd is connected. As soon as it
    connects, the size will be changed to the real value and a uevent is
    created. When disconnecting, the blockdevice is set to 0 size and
    another uevent is generated.
    Signed-off-by: default avatarMarkus Pargmann <mpa@pengutronix.de>
    37091fdd
nbd.c 25.6 KB