Merge pull request #30438 from dillaman/wip-41833

cls/rbd: sanitize entity instance messenger version type

Reviewed-by: Mykola Golub <mgolub@suse.com>
This commit is contained in:
Mykola Golub 2019-09-20 11:59:27 +03:00 committed by GitHub
commit 72076d3a0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4651,6 +4651,13 @@ int uuid_get(cls_method_context_t hctx, std::string *mirror_uuid) {
return 0;
}
void sanitize_entity_inst(entity_inst_t* entity_inst) {
// make all addrs of type ANY because the type isn't what uniquely
// identifies them and clients and on-disk formats can be encoded
// with different backwards compatibility settings.
entity_inst->addr.set_type(entity_addr_t::TYPE_ANY);
}
int list_watchers(cls_method_context_t hctx,
std::set<entity_inst_t> *entities) {
obj_list_watch_response_t watchers;
@ -4662,7 +4669,10 @@ int list_watchers(cls_method_context_t hctx,
entities->clear();
for (auto &w : watchers.entries) {
entities->emplace(w.name, w.addr);
entity_inst_t entity_inst{w.name, w.addr};
sanitize_entity_inst(&entity_inst);
entities->insert(entity_inst);
}
return 0;
}
@ -4894,6 +4904,7 @@ int image_status_set(cls_method_context_t hctx, const string &global_image_id,
ondisk_status.last_update = ceph_clock_now();
int r = cls_get_request_origin(hctx, &ondisk_status.origin);
sanitize_entity_inst(&ondisk_status.origin);
ceph_assert(r == 0);
bufferlist bl;