All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 5/5] rbd: set up devices only for mapped images
Date: Mon, 29 Apr 2013 13:01:11 -0500	[thread overview]
Message-ID: <517EB567.60303@inktank.com> (raw)
In-Reply-To: <517EB4F0.1070607@inktank.com>

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(-)

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);
 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;
-- 
1.7.9.5


  parent reply	other threads:[~2013-04-29 18:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-29 17:59 [PATCH 0/5] rbd: only set up Linux files for mapped devices Alex Elder
2013-04-29 18:00 ` [PATCH 1/5] rbd: drop module later Alex Elder
2013-04-29 18:00 ` [PATCH 2/5] rbd: don't destroy rbd_dev in device release function Alex Elder
2013-04-29 18:00 ` [PATCH 3/5] rbd: define rbd_dev_unprobe() Alex Elder
2013-05-01  1:11   ` Josh Durgin
2013-05-01  4:57     ` Alex Elder
2013-04-29 18:00 ` [PATCH 4/5] rbd: don't have device release destroy rbd_dev Alex Elder
2013-04-29 18:01 ` Alex Elder [this message]
2013-05-01  1:15 ` [PATCH 0/5] rbd: only set up Linux files for mapped devices Josh Durgin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=517EB567.60303@inktank.com \
    --to=elder@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.