• Josef Bacik's avatar
    nbd: separate out the config information · 5ea8d108
    Josef Bacik authored
    In order to properly refcount the various aspects of a NBD device we
    need to separate out the configuration elements of the nbd device.  The
    configuration of a NBD device has a different lifetime from the actual
    device, so it doesn't make sense to bundle these two concepts.  Add a
    config_refs to keep track of the configuration structure, that way we
    can be sure that we never access it when we've torn down the device.
    Add a new nbd_config structure to hold all of the transient
    configuration information.  Finally create this when we open the device
    so that it is in place when we start to configure the device.  This has
    a nice side-effect of fixing a long standing problem where you could end
    up with a half-configured nbd device that needed to be "disconnected" in
    order to be usable again.  Now once we close our device the
    configuration will be discarded.
    Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
    Signed-off-by: default avatarJens Axboe <axboe@fb.com>
    5ea8d108
nbd.c 33.8 KB