]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: ack pending notify when unwatching
authorSage Weil <sage@inktank.com>
Thu, 31 May 2012 05:16:03 +0000 (22:16 -0700)
committerSage Weil <sage@inktank.com>
Thu, 31 May 2012 05:16:03 +0000 (22:16 -0700)
If an unwatch crosses paths with a notify, we currently force the notifier
to keep waiting.  Instead, implicitly ack any notify when we unwatch.

Fixes: #2491
Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/ReplicatedPG.cc

index c52462c498fb4d0ba9f1a330c14a8182630614ad..2fe4246255f00e517ed0d72ec46e32cec4d74759 100644 (file)
@@ -3012,6 +3012,19 @@ void ReplicatedPG::do_osd_op_effects(OpContext *ctx)
        assert(obc->unconnected_watchers.count(entity));
        unregister_unconnected_watcher(obc, entity);
       }
+
+      // ack any pending notifies
+      map<void*, entity_name_t>::iterator p = session->notifs.begin();
+      while (p != session->notifs.end()) {
+       Watch::Notification *notif = (Watch::Notification *)p->first;
+       entity_name_t by = p->second;
+       p++;
+       if (notif->obc == obc) {
+         dout(10) << " acking pending notif " << notif->id << " by " << by << dendl;
+         session->del_notif(notif);
+         osd->ack_notification(entity, notif, obc, this);
+       }
+      }
     }
 
     for (list<notify_info_t>::iterator p = ctx->notifies.begin();