From: Sage Weil Date: Mon, 14 Jan 2019 20:50:54 +0000 (-0600) Subject: cls/lock: always store v1 addr in locker_info_t X-Git-Tag: v14.1.0~391^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4372688e28b2af35b31b350acdefa24b63965148;p=ceph.git cls/lock: always store v1 addr in locker_info_t Signed-off-by: Sage Weil --- diff --git a/src/cls/lock/cls_lock.cc b/src/cls/lock/cls_lock.cc index 88ea6a71b0c9..3d5b243e2924 100644 --- a/src/cls/lock/cls_lock.cc +++ b/src/cls/lock/cls_lock.cc @@ -216,6 +216,13 @@ static int lock_obj(cls_method_context_t hctx, expiration += duration; } + // make all addrs of type legacy, because v2 clients speak v2 or v1, + // even depending on which OSD they are talking to, and the type + // isn't what uniquely identifies them. also, storing a v1 addr + // here means that old clients who get this locker_info won't see an + // old "msgr2:" prefix. + inst.addr.set_type(entity_addr_t::TYPE_LEGACY); + struct locker_info_t info(expiration, inst.addr, description); linfo.lockers[id] = info; diff --git a/src/cls/lock/cls_lock_ops.cc b/src/cls/lock/cls_lock_ops.cc index 28c08f344763..aa5f8245d2fa 100644 --- a/src/cls/lock/cls_lock_ops.cc +++ b/src/cls/lock/cls_lock_ops.cc @@ -121,7 +121,7 @@ void cls_lock_get_info_reply::dump(Formatter *f) const f->dump_string("description", info.description); f->dump_string("cookie", id.cookie); f->dump_stream("expiration") << info.expiration; - f->dump_stream("addr") << info.addr; + f->dump_string("addr", info.addr.get_legacy_str()); f->close_section(); } f->close_section(); diff --git a/src/cls/lock/cls_lock_types.cc b/src/cls/lock/cls_lock_types.cc index d7691e08b752..d1aa63342126 100644 --- a/src/cls/lock/cls_lock_types.cc +++ b/src/cls/lock/cls_lock_types.cc @@ -41,7 +41,7 @@ void locker_id_t::generate_test_instances(list& o) void locker_info_t::dump(Formatter *f) const { f->dump_stream("expiration") << expiration; - f->dump_stream("addr") << addr; + f->dump_string("addr", addr.get_legacy_str()); f->dump_string("description", description); }