diff mbox

[4/5] rbd: don't have device release destroy rbd_dev

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

Commit Message

Alex Elder April 29, 2013, 6 p.m. UTC
Currently an rbd_device structure gets destroyed from the release
routine for the device embedded within it.  Stop doing that, instead
calling rbd_dev_image_release() right after rbd_bus_del_dev()
wherever the latter is called.

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


@@ -5079,6 +5078,7 @@ static ssize_t rbd_remove(struct bus_type *bus,
 		goto done;
 	ret = count;
 	rbd_bus_del_dev(rbd_dev);
+	rbd_dev_image_release(rbd_dev);
 	module_put(THIS_MODULE);
 done:
 	mutex_unlock(&ctl_mutex);
diff mbox

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 595d7b3..ff850e9 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -5013,8 +5013,6 @@  static void rbd_dev_device_release(struct device *dev)
 	rbd_dev->major = 0;
 	rbd_dev_id_put(rbd_dev);
 	rbd_dev_mapping_clear(rbd_dev);
-
-	rbd_dev_image_release(rbd_dev);
 }

 static void rbd_dev_remove_parent(struct rbd_device *rbd_dev)
@@ -5034,6 +5032,7 @@  static void rbd_dev_remove_parent(struct
rbd_device *rbd_dev)
 		}
 		rbd_assert(second);
 		rbd_bus_del_dev(second);
+		rbd_dev_image_release(second);
 		first->parent = NULL;
 		first->parent_overlap = 0;