mirror of
https://github.com/ceph/ceph
synced 2025-02-23 11:07:35 +00:00
Merge PR #31824 into master
* refs/pull/31824/head: cls/rbd: sanitize the mirror image status peer address after reading from disk Reviewed-by: Mykola Golub <mgolub@suse.com>
This commit is contained in:
commit
4d2a06e9ea
@ -4662,13 +4662,6 @@ 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;
|
||||
@ -4681,7 +4674,7 @@ int list_watchers(cls_method_context_t hctx,
|
||||
entities->clear();
|
||||
for (auto &w : watchers.entries) {
|
||||
entity_inst_t entity_inst{w.name, w.addr};
|
||||
sanitize_entity_inst(&entity_inst);
|
||||
cls::rbd::sanitize_entity_inst(&entity_inst);
|
||||
|
||||
entities->insert(entity_inst);
|
||||
}
|
||||
@ -5055,7 +5048,6 @@ 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;
|
||||
|
@ -287,7 +287,9 @@ std::ostream& operator<<(std::ostream& os,
|
||||
void MirrorImageSiteStatusOnDisk::encode_meta(bufferlist &bl,
|
||||
uint64_t features) const {
|
||||
ENCODE_START(1, 1, bl);
|
||||
encode(origin, bl, features);
|
||||
auto sanitized_origin = origin;
|
||||
sanitize_entity_inst(&sanitized_origin);
|
||||
encode(sanitized_origin, bl, features);
|
||||
ENCODE_FINISH(bl);
|
||||
}
|
||||
|
||||
@ -300,6 +302,7 @@ void MirrorImageSiteStatusOnDisk::encode(bufferlist &bl,
|
||||
void MirrorImageSiteStatusOnDisk::decode_meta(bufferlist::const_iterator &it) {
|
||||
DECODE_START(1, it);
|
||||
decode(origin, it);
|
||||
sanitize_entity_inst(&origin);
|
||||
DECODE_FINISH(it);
|
||||
}
|
||||
|
||||
@ -1146,5 +1149,12 @@ std::ostream& operator<<(std::ostream& os, const AssertSnapcSeqState& state) {
|
||||
return os;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
} // namespace rbd
|
||||
} // namespace cls
|
||||
|
@ -869,6 +869,8 @@ inline void decode(AssertSnapcSeqState &state, bufferlist::const_iterator& it) {
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const AssertSnapcSeqState& state);
|
||||
|
||||
void sanitize_entity_inst(entity_inst_t* entity_inst);
|
||||
|
||||
} // namespace rbd
|
||||
} // namespace cls
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user