diff options
author | Yehuda Sadeh <yehuda@hq.newdream.net> | 2011-01-07 17:58:42 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2011-01-12 18:15:18 -0500 |
commit | 766fc43973b16f9becb6b7402b3e052dbb84adee (patch) | |
tree | 47a0b50d6fd7fac744a69dbeaf78e80e3d17fc7b /drivers/block/rbd.c | |
parent | f363e45fd1184219b472ea549cb7e192e24ef4d2 (diff) |
rbd: fix cleanup when trying to mount inexistent image
Previously we didn't clean up the sysfs entry that was just
created.
Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r-- | drivers/block/rbd.c | 19 |
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 | ||
1802 | err_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 | |||
1801 | err_out_blkdev: | 1814 | err_out_blkdev: |
1802 | unregister_blkdev(rbd_dev->major, rbd_dev->name); | 1815 | unregister_blkdev(rbd_dev->major, rbd_dev->name); |
1803 | err_out_disk: | ||
1804 | rbd_free_disk(rbd_dev); | ||
1805 | err_out_client: | 1816 | err_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); |