aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/rbd.c
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@redhat.com>2015-01-08 12:18:22 -0500
committerIlya Dryomov <idryomov@gmail.com>2015-02-19 05:31:38 -0500
commit73e39e4dba828fe1affefe6290456623319707bd (patch)
tree436c5f303096c5c7ce9417b52259da129fe83674 /drivers/block/rbd.c
parent982d6011bc30a26e8a3d546e0e7fc7db2c255d85 (diff)
rbd: fix error paths in rbd_dev_refresh()
header_rwsem should be released on errors. Also remove useless rbd_dev->mapping.size != rbd_dev->header.image_size test. Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r--drivers/block/rbd.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index ef070d7c5e3c..b85d52005a21 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3694,7 +3694,7 @@ static int rbd_dev_refresh(struct rbd_device *rbd_dev)
3694 3694
3695 ret = rbd_dev_header_info(rbd_dev); 3695 ret = rbd_dev_header_info(rbd_dev);
3696 if (ret) 3696 if (ret)
3697 return ret; 3697 goto out;
3698 3698
3699 /* 3699 /*
3700 * If there is a parent, see if it has disappeared due to the 3700 * If there is a parent, see if it has disappeared due to the
@@ -3703,23 +3703,22 @@ static int rbd_dev_refresh(struct rbd_device *rbd_dev)
3703 if (rbd_dev->parent) { 3703 if (rbd_dev->parent) {
3704 ret = rbd_dev_v2_parent_info(rbd_dev); 3704 ret = rbd_dev_v2_parent_info(rbd_dev);
3705 if (ret) 3705 if (ret)
3706 return ret; 3706 goto out;
3707 } 3707 }
3708 3708
3709 if (rbd_dev->spec->snap_id == CEPH_NOSNAP) { 3709 if (rbd_dev->spec->snap_id == CEPH_NOSNAP) {
3710 if (rbd_dev->mapping.size != rbd_dev->header.image_size) 3710 rbd_dev->mapping.size = rbd_dev->header.image_size;
3711 rbd_dev->mapping.size = rbd_dev->header.image_size;
3712 } else { 3711 } else {
3713 /* validate mapped snapshot's EXISTS flag */ 3712 /* validate mapped snapshot's EXISTS flag */
3714 rbd_exists_validate(rbd_dev); 3713 rbd_exists_validate(rbd_dev);
3715 } 3714 }
3716 3715
3716out:
3717 up_write(&rbd_dev->header_rwsem); 3717 up_write(&rbd_dev->header_rwsem);
3718 3718 if (!ret && mapping_size != rbd_dev->mapping.size)
3719 if (mapping_size != rbd_dev->mapping.size)
3720 rbd_dev_update_size(rbd_dev); 3719 rbd_dev_update_size(rbd_dev);
3721 3720
3722 return 0; 3721 return ret;
3723} 3722}
3724 3723
3725static int rbd_init_disk(struct rbd_device *rbd_dev) 3724static int rbd_init_disk(struct rbd_device *rbd_dev)