diff mbox

[5/5] rbd: set up devices only for mapped images

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

Commit Message

Alex Elder April 29, 2013, 6:01 p.m. UTC
Stop setting up Linux devices during the image probe operation.
Instead, set up the devices as a separate step after the image
probe, in rbd_add().

A consequence of this is that only mapped images get devices
assigned to them, which is pretty sweet.

This resolves:
    http://tracker.ceph.com/issues/4774

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

 err_out_probe:
@@ -4966,9 +4961,12 @@ static ssize_t rbd_add(struct bus_type *bus,
 	if (rc < 0)
 		goto err_out_rbd_dev;

-	return count;
+	rc = rbd_dev_device_setup(rbd_dev);
+	if (!rc)
+		return count;
+
+	rbd_dev_image_release(rbd_dev);
 err_out_rbd_dev:
-	kfree(rbd_dev->header_name);
 	rbd_dev_destroy(rbd_dev);
 err_out_client:
 	rbd_put_client(rbdc);
@@ -5031,7 +5029,6 @@ static void rbd_dev_remove_parent(struct
rbd_device *rbd_dev)
 			second = third;
 		}
 		rbd_assert(second);
-		rbd_bus_del_dev(second);
 		rbd_dev_image_release(second);
 		first->parent = NULL;
 		first->parent_overlap = 0;
diff mbox

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index ff850e9..8b680ad 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4880,14 +4880,9 @@  static int rbd_dev_image_probe(struct rbd_device
*rbd_dev)
 		goto err_out_snaps;

 	ret = rbd_dev_probe_parent(rbd_dev);
-	if (ret)
-		goto err_out_snaps;
-
-	ret = rbd_dev_device_setup(rbd_dev);
 	if (!ret)
 		return 0;

-	rbd_dev_remove_parent(rbd_dev);
 err_out_snaps:
 	rbd_remove_all_snaps(rbd_dev);