From: Sage Weil Date: Thu, 1 Oct 2015 18:50:00 +0000 (-0400) Subject: osd: reply to notify request with our unique notify_id X-Git-Tag: v9.1.0~39^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=049ea702b9bf4a8a62ae2770d9ba55c0730b3eef;p=ceph.git osd: reply to notify request with our unique notify_id The OSD assigns a unique ID to each notify it queues for processing. Include this in the reply to the notifier so that they can match it up with the eventual completions they receive. This is necessary to distinguish between multiple completions they may receive if there is PG peering and the notify is resent. In particular, an earlier notify may return an error when a later attempt succeeds. This is forwards and backwards compatible: new clients will make use of this reply payload but older clients ignore it. Signed-off-by: Sage Weil --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 857ed09b38af..f294401e5c3c 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4527,9 +4527,13 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops) notify_info_t n; n.timeout = timeout; + n.notify_id = osd->get_next_id(get_osdmap()->get_epoch()); n.cookie = op.watch.cookie; n.bl = bl; ctx->notifies.push_back(n); + + // return our unique notify id to the client + ::encode(n.notify_id, osd_op.outdata); } break; @@ -6058,7 +6062,7 @@ void ReplicatedPG::do_osd_op_effects(OpContext *ctx, const ConnectionRef& conn) p->bl, p->timeout, p->cookie, - osd->get_next_id(get_osdmap()->get_epoch()), + p->notify_id, ctx->obc->obs.oi.user_version, osd)); for (map, WatchRef>::iterator i = diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 828485340908..d51c894632bb 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -2981,12 +2981,15 @@ static inline ostream& operator<<(ostream& out, const watch_info_t& w) { struct notify_info_t { uint64_t cookie; + uint64_t notify_id; uint32_t timeout; bufferlist bl; }; static inline ostream& operator<<(ostream& out, const notify_info_t& n) { - return out << "notify(cookie " << n.cookie << " " << n.timeout << "s)"; + return out << "notify(cookie " << n.cookie + << " notify" << n.notify_id + << " " << n.timeout << "s)"; }