]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: include ETIMEDOUT in notify reply on timeout
authorSage Weil <sage@redhat.com>
Mon, 11 Aug 2014 00:52:18 +0000 (17:52 -0700)
committerJohn Spray <john.spray@redhat.com>
Mon, 25 Aug 2014 00:34:18 +0000 (01:34 +0100)
If a notify operation times out (all watchers to not ACK in time), include
an ETIMEDOUT in the final error message back to the client, so that they
know about it.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/Watch.cc
src/osd/Watch.h

index 4fdb1246020007402474b65b5da9795424d1bdec..7b324957ef0058e4798f97f6dfd079739a3bed44 100644 (file)
@@ -39,6 +39,7 @@ Notify::Notify(
     in_progress_watchers(num_watchers),
     complete(false),
     discarded(false),
+    timed_out(false),
     payload(payload),
     timeout(timeout),
     cookie(cookie),
@@ -97,7 +98,8 @@ void Notify::do_timeout()
     return;
   }
 
-  in_progress_watchers = 0; // we give up TODO: we should return an error code
+  in_progress_watchers = 0; // we give up
+  timed_out = true;         // we will send the client and error code
   maybe_complete_notify();
   assert(complete);
   set<WatchRef> _watchers;
@@ -170,6 +172,8 @@ void Notify::maybe_complete_notify()
   if (!in_progress_watchers) {
     MWatchNotify *reply(new MWatchNotify(cookie, version, notify_id,
                                         WATCH_NOTIFY, payload));
+    if (timed_out)
+      reply->return_code = -ETIMEDOUT;
     osd->send_message_osd_client(reply, client.get());
     unregister_cb();
     complete = true;
index e2cbfc1b6870d03ab23cc53c7e0e299048af7ad3..ceae6ad0edc34ae962902e20baac156b56e0a920 100644 (file)
@@ -58,6 +58,7 @@ class Notify {
   unsigned in_progress_watchers;
   bool complete;
   bool discarded;
+  bool timed_out;  ///< true if the notify timed out
   set<WatchRef> watchers;
 
   bufferlist payload;