]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: send notify reply if there are not watchers
authorYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 30 Sep 2010 04:23:27 +0000 (21:23 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 24 Nov 2010 00:49:45 +0000 (16:49 -0800)
src/osd/ReplicatedPG.cc

index 1dfab2abaa767102c4c977edc0e96856a0a2ef66..042f7d5a6324d32656708effa03251e727e13d7e 100644 (file)
@@ -1114,10 +1114,19 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops,
            MWatchNotify *notify_msg = new MWatchNotify(w.cookie, w.ver, notif->id, WATCH_NOTIFY);
            osd->client_messenger->send_message(notify_msg, session->con);
          } else {
-           notif->add_watcher(oi_iter->first, Watch::WATCHER_PENDING);
+           /* FIXME: check timestamp on session disconnection */
+           // notif->add_watcher(oi_iter->first, Watch::WATCHER_PENDING);
            dout(0) << " session was not found" << dendl;
          }
        }
+
+       if (notif->watchers.empty()) {
+         MWatchNotify *reply = new MWatchNotify(op.watch.cookie, op.watch.ver, notif->id, WATCH_NOTIFY_COMPLETE);
+         osd->client_messenger->send_message(reply, notif->session->con);
+         notif->session->put();
+         osd->watch->remove_notification(notif);
+         delete notif;
+       }
       }
       break;