From: Sage Weil Date: Sat, 8 Nov 2014 01:47:09 +0000 (-0800) Subject: osd, librados: distinguish between old and new watchers X-Git-Tag: v0.91~127 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1a82cc3926fc7bc4cfbdd2fd4dfee8660d5107a1;p=ceph.git osd, librados: distinguish between old and new watchers Use a new watch op code that is different from the legacy one so we can tell when the client is doing all the new stuff (like sending pings). Signed-off-by: Sage Weil --- diff --git a/src/include/rados.h b/src/include/rados.h index fac5ffc0075..f8bba2a1cc6 100644 --- a/src/include/rados.h +++ b/src/include/rados.h @@ -448,11 +448,12 @@ enum { enum { CEPH_OSD_WATCH_OP_UNWATCH = 0, - CEPH_OSD_WATCH_OP_WATCH = 1, + CEPH_OSD_WATCH_OP_LEGACY_WATCH = 1, /* note: use only ODD ids to prevent pre-giant code from interpreting the op as UNWATCH */ - CEPH_OSD_WATCH_OP_RECONNECT = 3, - CEPH_OSD_WATCH_OP_PING = 5, + CEPH_OSD_WATCH_OP_WATCH = 3, + CEPH_OSD_WATCH_OP_RECONNECT = 5, + CEPH_OSD_WATCH_OP_PING = 7, }; const char *ceph_osd_watch_op_name(int o); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 084f85102f2..7aaf07080fc 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4303,7 +4303,8 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops) watch_info_t w(cookie, cct->_conf->osd_client_watch_timeout, ctx->op->get_req()->get_connection()->get_peer_addr()); - if (op.watch.op == CEPH_OSD_WATCH_OP_WATCH) { + if (op.watch.op == CEPH_OSD_WATCH_OP_WATCH || + op.watch.op == CEPH_OSD_WATCH_OP_LEGACY_WATCH) { if (oi.watchers.count(make_pair(cookie, entity))) { dout(10) << " found existing watch " << w << " by " << entity << dendl; } else {