rbd: rbd-mirroring: Fixed if clause in mirror_image_get_info

This fix targets the case when journaling is not enabled but
someone calls mirror_image_get_info.

Signed-off-by: Ricardo Dias <rdias@suse.com>
This commit is contained in:
Ricardo Dias 2016-03-18 10:36:46 +00:00
parent c472493659
commit 6ebb4f36b2

View File

@ -2718,11 +2718,15 @@ int validate_mirroring_enabled(ImageCtx *ictx) {
static_cast<rbd_mirror_image_state_t>(mirror_image_internal.state);
}
r = Journal<>::is_tag_owner(ictx, &mirror_image_info->primary);
if (r < 0) {
lderr(cct) << "failed to check tag ownership: "
<< cpp_strerror(r) << dendl;
return r;
if (mirror_image_info->state == RBD_MIRROR_IMAGE_ENABLED) {
r = Journal<>::is_tag_owner(ictx, &mirror_image_info->primary);
if (r < 0) {
lderr(cct) << "failed to check tag ownership: "
<< cpp_strerror(r) << dendl;
return r;
}
} else {
mirror_image_info->primary = false;
}
return 0;