]> asedeno.scripts.mit.edu Git - linux.git/commit
nbd: separate out the config information
authorJosef Bacik <josef@toxicpanda.com>
Thu, 6 Apr 2017 21:01:58 +0000 (17:01 -0400)
committerJens Axboe <axboe@fb.com>
Mon, 17 Apr 2017 15:58:42 +0000 (09:58 -0600)
commit5ea8d10802ec4c153a6e21eebaf412e2abd29736
tree2f71b4826ca592e1a8ec55c572d21ccee10eaba9
parentf3733247ae7c5fc0fa4c7303438f9e18a6ebb5ec
nbd: separate out the config information

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: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/nbd.c