aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/rbd.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 008d4a00b50d..e1e38b11f48a 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1790,18 +1790,29 @@ static ssize_t rbd_add(struct bus_type *bus, const char *buf, size_t count)
1790 1790
1791 rc = rbd_bus_add_dev(rbd_dev); 1791 rc = rbd_bus_add_dev(rbd_dev);
1792 if (rc) 1792 if (rc)
1793 goto err_out_disk; 1793 goto err_out_blkdev;
1794
1794 /* set up and announce blkdev mapping */ 1795 /* set up and announce blkdev mapping */
1795 rc = rbd_init_disk(rbd_dev); 1796 rc = rbd_init_disk(rbd_dev);
1796 if (rc) 1797 if (rc)
1797 goto err_out_blkdev; 1798 goto err_out_bus;
1798 1799
1799 return count; 1800 return count;
1800 1801
1802err_out_bus:
1803 mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
1804 list_del_init(&rbd_dev->node);
1805 mutex_unlock(&ctl_mutex);
1806
1807 /* this will also clean up rest of rbd_dev stuff */
1808
1809 rbd_bus_del_dev(rbd_dev);
1810 kfree(options);
1811 kfree(mon_dev_name);
1812 return rc;
1813
1801err_out_blkdev: 1814err_out_blkdev:
1802 unregister_blkdev(rbd_dev->major, rbd_dev->name); 1815 unregister_blkdev(rbd_dev->major, rbd_dev->name);
1803err_out_disk:
1804 rbd_free_disk(rbd_dev);
1805err_out_client: 1816err_out_client:
1806 rbd_put_client(rbd_dev); 1817 rbd_put_client(rbd_dev);
1807 mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); 1818 mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);