diff options
author | Yehuda Sadeh <yehuda@hq.newdream.net> | 2011-01-07 23:58:42 +0100 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2011-01-13 00:15:18 +0100 |
commit | 766fc43973b16f9becb6b7402b3e052dbb84adee (patch) | |
tree | 47a0b50d6fd7fac744a69dbeaf78e80e3d17fc7b /drivers/block | |
parent | net/ceph: make ceph_msgr_wq non-reentrant (diff) | |
download | linux-766fc43973b16f9becb6b7402b3e052dbb84adee.tar.xz linux-766fc43973b16f9becb6b7402b3e052dbb84adee.zip |
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')
-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) rc = rbd_bus_add_dev(rbd_dev); if (rc) - goto err_out_disk; + goto err_out_blkdev; + /* set up and announce blkdev mapping */ rc = rbd_init_disk(rbd_dev); if (rc) - goto err_out_blkdev; + goto err_out_bus; return count; +err_out_bus: + mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); + list_del_init(&rbd_dev->node); + mutex_unlock(&ctl_mutex); + + /* this will also clean up rest of rbd_dev stuff */ + + rbd_bus_del_dev(rbd_dev); + kfree(options); + kfree(mon_dev_name); + return rc; + err_out_blkdev: unregister_blkdev(rbd_dev->major, rbd_dev->name); -err_out_disk: - rbd_free_disk(rbd_dev); err_out_client: rbd_put_client(rbd_dev); mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |