diff mbox

[1/5] rbd: move more initialization into rbd_dev_probe_image()

Message ID 517C2966.5040103@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder April 27, 2013, 7:39 p.m. UTC
Move a block of initialization related to the "ceph-side" of an rbd
image out of rbd_dev_probe_finish() and into rbd_dev_probe_image().

Signed-off-by: Alex Elder <elder@inktank.com>
---
 drivers/block/rbd.c |   35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)


@@ -4817,8 +4804,6 @@ err_out_id:
 	rbd_dev_id_put(rbd_dev);
 	if (rbd_dev->parent);
 		rbd_dev_remove_parent(rbd_dev);
-err_out_snaps:
-	rbd_remove_all_snaps(rbd_dev);

 	return ret;
 }
@@ -4849,11 +4834,29 @@ static int rbd_dev_probe_image(struct rbd_device
*rbd_dev)
 	if (ret)
 		goto out_err;

+	ret = rbd_dev_snaps_update(rbd_dev);
+	if (ret)
+		goto out_err;
+
+	ret = rbd_dev_spec_update(rbd_dev);
+	if (ret)
+		goto err_out_snaps;
+
+	ret = rbd_dev_probe_parent(rbd_dev);
+	if (ret)
+		goto err_out_snaps;
+
 	ret = rbd_dev_probe_finish(rbd_dev);
 	if (ret)
-		rbd_header_free(&rbd_dev->header);
+		goto err_out_parent;

 	return ret;
+err_out_parent:
+	rbd_header_free(&rbd_dev->header);
+	if (rbd_dev->parent);
+		rbd_dev_remove_parent(rbd_dev);
+err_out_snaps:
+	rbd_remove_all_snaps(rbd_dev);
 out_err:
 	kfree(rbd_dev->spec->image_id);
 	rbd_dev->spec->image_id = NULL;
diff mbox

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 5fd923f..8a9ad60 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4742,19 +4742,6 @@  static int rbd_dev_probe_finish(struct rbd_device
*rbd_dev)
 {
 	int ret;

-	/* no need to lock here, as rbd_dev is not registered yet */
-	ret = rbd_dev_snaps_update(rbd_dev);
-	if (ret)
-		return ret;
-
-	ret = rbd_dev_spec_update(rbd_dev);
-	if (ret)
-		goto err_out_snaps;
-
-	ret = rbd_dev_probe_parent(rbd_dev);
-	if (ret)
-		goto err_out_snaps;
-
 	/* generate unique id: find highest unique id, add one */
 	rbd_dev_id_get(rbd_dev);