diff options
author | Alex Elder <elder@inktank.com> | 2012-08-30 00:16:38 -0500 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2012-10-01 14:30:52 -0500 |
commit | cd789ab9cacbda1aad43304b89cff29004b793ea (patch) | |
tree | 1338d6dd30abd2b1828bc724c84599afbac9751e /drivers/block | |
parent | 4bb1f1ed0063870f34ae5783cda08924964bac0b (diff) | |
download | linux-stable-cd789ab9cacbda1aad43304b89cff29004b793ea.tar.gz linux-stable-cd789ab9cacbda1aad43304b89cff29004b793ea.tar.bz2 linux-stable-cd789ab9cacbda1aad43304b89cff29004b793ea.zip |
rbd: don't register snapshots in bus_add_dev()
When rbd_bus_add_dev() is called (one spot--in rbd_add()), the rbd
image header has not even been read yet. This means that the list
of snapshots will be empty at the time of the call. As a result,
there is no need for the code that calls rbd_register_snap_dev()
for each entry in that list--so get rid of it.
Once the header has been read (just after returning), a call will
be made to rbd_dev_snap_devs_update(), which will then find every
snapshot in the context to be new and will therefore call
rbd_register_snap_dev() via __rbd_add_snap_dev() accomplishing
the same thing.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/rbd.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 214c937a6de5..144694ee03a5 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2244,29 +2244,21 @@ static int rbd_dev_snap_devs_update(struct rbd_device *rbd_dev) static int rbd_bus_add_dev(struct rbd_device *rbd_dev) { - int ret; struct device *dev; - struct rbd_snap *snap; + int ret; mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); - dev = &rbd_dev->dev; + dev = &rbd_dev->dev; dev->bus = &rbd_bus_type; dev->type = &rbd_device_type; dev->parent = &rbd_root_dev; dev->release = rbd_dev_release; dev_set_name(dev, "%d", rbd_dev->dev_id); ret = device_register(dev); - if (ret < 0) - goto out; - list_for_each_entry(snap, &rbd_dev->snaps, node) { - ret = rbd_register_snap_dev(snap, &rbd_dev->dev); - if (ret < 0) - break; - } -out: mutex_unlock(&ctl_mutex); + return ret; } |