From 241838cf581532ee7fe71df225601db77af34d89 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Tue, 24 Dec 2019 13:57:23 +0100 Subject: [PATCH] messages: MWatchNotify takes notifier_gid during construction. Signed-off-by: Radoslaw Zarzynski --- src/messages/MWatchNotify.h | 4 ++-- src/osd/Watch.cc | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/messages/MWatchNotify.h b/src/messages/MWatchNotify.h index 7a31ec8c56bbf..a37dc8c85a551 100644 --- a/src/messages/MWatchNotify.h +++ b/src/messages/MWatchNotify.h @@ -35,7 +35,7 @@ private: MWatchNotify() : Message{CEPH_MSG_WATCH_NOTIFY, HEAD_VERSION, COMPAT_VERSION} { } - MWatchNotify(uint64_t c, uint64_t v, uint64_t i, uint8_t o, ceph::buffer::list b) + MWatchNotify(uint64_t c, uint64_t v, uint64_t i, uint8_t o, ceph::buffer::list b, uint64_t n=0) : Message{CEPH_MSG_WATCH_NOTIFY, HEAD_VERSION, COMPAT_VERSION}, cookie(c), ver(v), @@ -43,7 +43,7 @@ private: opcode(o), bl(b), return_code(0), - notifier_gid(0) { } + notifier_gid(n) { } private: ~MWatchNotify() override {} diff --git a/src/osd/Watch.cc b/src/osd/Watch.cc index 48fe50c07c149..c1e26f230c748 100644 --- a/src/osd/Watch.cc +++ b/src/osd/Watch.cc @@ -192,9 +192,13 @@ void Notify::maybe_complete_notify() encode(missed, bl); bufferlist empty; - MWatchNotify *reply(new MWatchNotify(cookie, version, notify_id, - CEPH_WATCH_EVENT_NOTIFY_COMPLETE, empty)); - reply->notifier_gid = client_gid; + auto* const reply = new MWatchNotify( + cookie, + version, + notify_id, + CEPH_WATCH_EVENT_NOTIFY_COMPLETE, + empty, + client_gid); reply->set_data(bl); if (timed_out) reply->return_code = -ETIMEDOUT; @@ -473,9 +477,12 @@ void Watch::send_notify(NotifyRef notif) { dout(10) << "send_notify" << dendl; MWatchNotify *notify_msg = new MWatchNotify( - cookie, notif->version, notif->notify_id, - CEPH_WATCH_EVENT_NOTIFY, notif->payload); - notify_msg->notifier_gid = notif->client_gid; + cookie, + notif->version, + notif->notify_id, + CEPH_WATCH_EVENT_NOTIFY, + notif->payload, + notif->client_gid); conn->send_message(notify_msg); } -- 2.39.5