提交 73e39e4d 编写于 作者: I Ilya Dryomov 提交者: Ilya Dryomov

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: NIlya Dryomov <idryomov@redhat.com>
上级 982d6011
...@@ -3694,7 +3694,7 @@ static int rbd_dev_refresh(struct rbd_device *rbd_dev) ...@@ -3694,7 +3694,7 @@ static int rbd_dev_refresh(struct rbd_device *rbd_dev)
ret = rbd_dev_header_info(rbd_dev); ret = rbd_dev_header_info(rbd_dev);
if (ret) if (ret)
return ret; goto out;
/* /*
* If there is a parent, see if it has disappeared due to the * 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,23 +3703,22 @@ static int rbd_dev_refresh(struct rbd_device *rbd_dev)
if (rbd_dev->parent) { if (rbd_dev->parent) {
ret = rbd_dev_v2_parent_info(rbd_dev); ret = rbd_dev_v2_parent_info(rbd_dev);
if (ret) if (ret)
return ret; goto out;
} }
if (rbd_dev->spec->snap_id == CEPH_NOSNAP) { if (rbd_dev->spec->snap_id == CEPH_NOSNAP) {
if (rbd_dev->mapping.size != rbd_dev->header.image_size) rbd_dev->mapping.size = rbd_dev->header.image_size;
rbd_dev->mapping.size = rbd_dev->header.image_size;
} else { } else {
/* validate mapped snapshot's EXISTS flag */ /* validate mapped snapshot's EXISTS flag */
rbd_exists_validate(rbd_dev); rbd_exists_validate(rbd_dev);
} }
out:
up_write(&rbd_dev->header_rwsem); up_write(&rbd_dev->header_rwsem);
if (!ret && mapping_size != rbd_dev->mapping.size)
if (mapping_size != rbd_dev->mapping.size)
rbd_dev_update_size(rbd_dev); rbd_dev_update_size(rbd_dev);
return 0; return ret;
} }
static int rbd_init_disk(struct rbd_device *rbd_dev) static int rbd_init_disk(struct rbd_device *rbd_dev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册