提交 9f5dffdc 编写于 作者: A Alex Elder 提交者: Sage Weil

rbd: make rbd_dev_destroy() match rbd_dev_create()

Currently, rbd_dev_destroy() does more than just the inverse of what
rbd_dev_create() does.  Stop doing that, and move the two extra
things it does into the three call sites.
Signed-off-by: NAlex Elder <elder@inktank.com>
Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
上级 468521c1
...@@ -3425,8 +3425,6 @@ static struct rbd_device *rbd_dev_create(struct rbd_client *rbdc, ...@@ -3425,8 +3425,6 @@ static struct rbd_device *rbd_dev_create(struct rbd_client *rbdc,
static void rbd_dev_destroy(struct rbd_device *rbd_dev) static void rbd_dev_destroy(struct rbd_device *rbd_dev)
{ {
rbd_spec_put(rbd_dev->parent_spec);
kfree(rbd_dev->header_name);
rbd_put_client(rbd_dev->rbd_client); rbd_put_client(rbd_dev->rbd_client);
rbd_spec_put(rbd_dev->spec); rbd_spec_put(rbd_dev->spec);
kfree(rbd_dev); kfree(rbd_dev);
...@@ -4788,6 +4786,8 @@ static int rbd_dev_probe_finish(struct rbd_device *rbd_dev) ...@@ -4788,6 +4786,8 @@ static int rbd_dev_probe_finish(struct rbd_device *rbd_dev)
return ret; return ret;
err_out_parent: err_out_parent:
rbd_spec_put(rbd_dev->parent_spec);
kfree(rbd_dev->header_name);
rbd_dev_destroy(parent); rbd_dev_destroy(parent);
err_out_spec: err_out_spec:
rbd_spec_put(parent_spec); rbd_spec_put(parent_spec);
...@@ -4910,6 +4910,8 @@ static ssize_t rbd_add(struct bus_type *bus, ...@@ -4910,6 +4910,8 @@ static ssize_t rbd_add(struct bus_type *bus,
return count; return count;
err_out_rbd_dev: err_out_rbd_dev:
rbd_spec_put(rbd_dev->parent_spec);
kfree(rbd_dev->header_name);
rbd_dev_destroy(rbd_dev); rbd_dev_destroy(rbd_dev);
err_out_client: err_out_client:
rbd_put_client(rbdc); rbd_put_client(rbdc);
...@@ -4960,6 +4962,8 @@ static void rbd_dev_release(struct device *dev) ...@@ -4960,6 +4962,8 @@ static void rbd_dev_release(struct device *dev)
/* done with the id, and with the rbd_dev */ /* done with the id, and with the rbd_dev */
rbd_dev_id_put(rbd_dev); rbd_dev_id_put(rbd_dev);
rbd_assert(rbd_dev->rbd_client != NULL); rbd_assert(rbd_dev->rbd_client != NULL);
rbd_spec_put(rbd_dev->parent_spec);
kfree(rbd_dev->header_name);
rbd_dev_destroy(rbd_dev); rbd_dev_destroy(rbd_dev);
/* release module ref */ /* release module ref */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册