]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: normalize watch error (ENOENT on delete)
authorSage Weil <sage@redhat.com>
Thu, 11 Dec 2014 14:26:06 +0000 (06:26 -0800)
committerSage Weil <sage@redhat.com>
Thu, 11 Dec 2014 14:26:06 +0000 (06:26 -0800)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 2ae8774c9025bc28bd49b288f0fa78159a62ceaf..f53783fe613632a18eb9bdf8a697600454c1ae91 100644 (file)
@@ -504,6 +504,16 @@ struct C_DoWatchError : public Context {
   }
 };
 
+int Objecter::_normalize_watch_error(int r)
+{
+  // translate ENOENT -> ENOTCONN so that a delete->disconnection
+  // notification and a failure to reconnect becuase we raced with
+  // the delete appear the same to the user.
+  if (r == -ENOENT)
+    r = -ENOTCONN;
+  return r;
+}
+
 void Objecter::_linger_reconnect(LingerOp *info, int r)
 {
   ldout(cct, 10) << __func__ << " " << info->linger_id << " = " << r
@@ -511,6 +521,7 @@ void Objecter::_linger_reconnect(LingerOp *info, int r)
   if (r < 0) {
     info->watch_lock.get_write();
     if (!info->last_error) {
+      r = _normalize_watch_error(r);
       info->last_error = r;
       if (info->watch_context)
        finisher->queue(new C_DoWatchError(info, r));
@@ -572,6 +583,7 @@ void Objecter::_linger_ping(LingerOp *info, int r, utime_t sent,
     if (r == 0) {
       info->watch_valid_thru = sent;
     } else if (r < 0 && !info->last_error) {
+      r = _normalize_watch_error(r);
       info->last_error = r;
       if (info->watch_context)
        finisher->queue(new C_DoWatchError(info, r));
index ba23f1b588c87aba7bd2a5c016058a1a9a7247fc..c21cd87a1eb465628c51b2c5bbc5e3b913cd8184 100644 (file)
@@ -1710,6 +1710,7 @@ public:
   void _linger_reconnect(LingerOp *info, int r);
   void _send_linger_ping(LingerOp *info);
   void _linger_ping(LingerOp *info, int r, utime_t sent, uint32_t register_gen);
+  int _normalize_watch_error(int r);
 
   void _check_op_pool_dne(Op *op, bool session_locked);
   void _send_op_map_check(Op *op);