]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: failure to update the object map should always return success 4564/head
authorJason Dillaman <dillaman@redhat.com>
Fri, 10 Apr 2015 16:37:05 +0000 (12:37 -0400)
committerLoic Dachary <ldachary@redhat.com>
Wed, 6 May 2015 09:29:51 +0000 (11:29 +0200)
If an object map update fails, the object map will be flagged as
invalid.  However, if a subsequent update failure occurs, the error
code will propagate back to the caller.

Fixes: #11369
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 99f5a7d595c653447b351898192410c9cb773770)

src/librbd/AsyncRequest.h
src/librbd/ObjectMap.h

index f81840a0f772db094662b9b5bc6e6a45a3aa8c2e..fd260a912c9be5592fa7de557521c63f4cf5f1f1 100644 (file)
@@ -23,7 +23,7 @@ public:
       m_on_finish->complete(-ERESTART);
       delete this;
     } else if (should_complete(r)) {
-      m_on_finish->complete(r);
+      m_on_finish->complete(filter_return_code(r));
       delete this;
     }
   }
@@ -48,7 +48,9 @@ protected:
     return true;
   }
   virtual bool should_complete(int r) = 0;
-
+  virtual int filter_return_code(int r) {
+    return r;
+  }
 private:
   bool m_canceled;
   xlist<AsyncRequest *>::item m_xlist_item;
index 564816f1193d6e0670091906e6be40eed3e56eb3..596f5cf6f4b705cc1029e4c1378359e26e9ead4e 100644 (file)
@@ -59,6 +59,10 @@ private:
 
   protected:
     virtual bool should_complete(int r);
+    virtual int filter_return_code(int r) {
+      // never propagate an error back to the caller
+      return 0;
+    }
     virtual void finish(ObjectMap *object_map) = 0;
 
   private:
@@ -76,7 +80,7 @@ private:
     State m_state;
 
     bool invalidate();
-  }; 
+  };
 
   class ResizeRequest : public Request {
   public: