diff options
author | Alex Elder <elder@inktank.com> | 2013-04-26 15:44:36 -0500 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-01 21:19:54 -0700 |
commit | ad945fc1da42965a31089d29de3754047861f348 (patch) | |
tree | 359b8c20a5f7fb4adc8516d803b59b614fe7a9a6 /drivers/block | |
parent | b480815a17bc6bfe85d4931c53e5a8fded7f889e (diff) | |
download | talos-obmc-linux-ad945fc1da42965a31089d29de3754047861f348.tar.gz talos-obmc-linux-ad945fc1da42965a31089d29de3754047861f348.zip |
rbd: fix rbd_dev_remove_parent()
In certain error paths, it is possible for an rbd device to have a
parent spec but no parent rbd_dev. In rbd_dev_remove_parent() use
the parent field rather than parent_spec in determining whether to
try to remove any parent devices. Use assertions to indicate that
any non-null parent pointer has parent_spec associated with it.
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 | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 0bae4e74555d..bc1e6e8e2ad9 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -4994,7 +4994,7 @@ static void rbd_dev_release(struct device *dev) static void rbd_dev_remove_parent(struct rbd_device *rbd_dev) { - while (rbd_dev->parent_spec) { + while (rbd_dev->parent) { struct rbd_device *first = rbd_dev; struct rbd_device *second = first->parent; struct rbd_device *third; @@ -5007,12 +5007,15 @@ static void rbd_dev_remove_parent(struct rbd_device *rbd_dev) first = second; second = third; } + rbd_assert(second); rbd_remove_all_snaps(second); rbd_bus_del_dev(second); + first->parent = NULL; + first->parent_overlap = 0; + + rbd_assert(first->parent_spec); rbd_spec_put(first->parent_spec); first->parent_spec = NULL; - first->parent_overlap = 0; - first->parent = NULL; } } |