]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
messages: Use atomic<bool> since these are used without locking
authorDavid Zafman <dzafman@redhat.com>
Fri, 11 Mar 2016 05:31:34 +0000 (21:31 -0800)
committerDavid Zafman <dzafman@redhat.com>
Mon, 14 Mar 2016 22:49:45 +0000 (15:49 -0700)
Doing this for clarity, since I haven't identified it as a bug.

Signed-off-by: David Zafman <dzafman@redhat.com>
src/messages/MOSDOp.h

index fc087fca54721fbccaa8c80b4af286a32844148a..912e3dfd24ebc068568e0369495fd8a0f5e70221 100755 (executable)
@@ -19,6 +19,7 @@
 #include "msg/Message.h"
 #include "osd/osd_types.h"
 #include "include/ceph_features.h"
+#include <atomic>
 
 /*
  * OSD op
@@ -48,8 +49,10 @@ private:
   pg_t pgid;
   bufferlist::iterator p;
   // Decoding flags. Decoding is only needed for messages catched by pipe reader.
-  bool partial_decode_needed;
-  bool final_decode_needed;
+  // Transition from true -> false without locks being held
+  // Can never see final_decode_needed == false and partial_decode_needed == true
+  atomic<bool> partial_decode_needed;
+  atomic<bool> final_decode_needed;
   //
 public:
   vector<OSDOp> ops;