]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/: treat PINGs as RWORDERED
authorSamuel Just <sjust@redhat.com>
Tue, 20 Dec 2016 17:47:41 +0000 (09:47 -0800)
committerSamuel Just <sjust@redhat.com>
Tue, 20 Dec 2016 17:47:41 +0000 (09:47 -0800)
89fd030bf9436dc4e37cc3a0f935ec077455d9d5 switched them to show up
as reads to avoid logging them, but we still pipeline them with
reconnects.  Thus, also force them to be rwordered.

Fixes: http://tracker.ceph.com/issues/18310
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/OSD.cc
src/osd/OpRequest.cc
src/osd/OpRequest.h
src/osd/PrimaryLogPG.cc
src/osd/osd_types.h

index a5963412e0db9c9511fe416a7e39cda245190f25..ac34033e6bb51c576071eca24b3859d28bca60c1 100644 (file)
@@ -9324,12 +9324,17 @@ int OSD::init_op_flags(OpRequestRef& op)
 
   // set bits based on op codes, called methods.
   for (iter = m->ops.begin(); iter != m->ops.end(); ++iter) {
-    if (!(iter->op.op == CEPH_OSD_OP_WATCH &&
-         iter->op.watch.op == CEPH_OSD_WATCH_OP_PING)) {
+    if ((iter->op.op == CEPH_OSD_OP_WATCH &&
+        iter->op.watch.op == CEPH_OSD_WATCH_OP_PING)) {
       /* This a bit odd.  PING isn't actually a write.  It can't
        * result in an update to the object_info.  PINGs also aren'ty
        * replayed, so there's no reason to write out a log entry
+       *
+       * However, we pipeline them behind writes, so let's force
+       * the write_ordered flag.
        */
+      op->set_force_rwordered();
+    } else {
       if (ceph_osd_op_mode_modify(iter->op.op))
        op->set_write();
     }
index 2b8d75d858d69e7b495347af78d26ca64e4abb2e..0e51d5c419ff82bd995f200004fd852a0f48d7a6 100644 (file)
@@ -96,6 +96,11 @@ bool OpRequest::may_write() {
   return need_write_cap() || check_rmw(CEPH_OSD_RMW_FLAG_CLASS_WRITE);
 }
 bool OpRequest::may_cache() { return check_rmw(CEPH_OSD_RMW_FLAG_CACHE); }
+bool OpRequest::rwordered_forced() { return check_rmw(CEPH_OSD_RMW_FLAG_CACHE); }
+bool OpRequest::rwordered() {
+  return may_write() || may_cache() || rwordered_forced();
+}
+
 bool OpRequest::includes_pg_op() { return check_rmw(CEPH_OSD_RMW_FLAG_PGOP); }
 bool OpRequest::need_read_cap() {
   return check_rmw(CEPH_OSD_RMW_FLAG_READ);
@@ -132,6 +137,7 @@ void OpRequest::set_cache() { set_rmw_flags(CEPH_OSD_RMW_FLAG_CACHE); }
 void OpRequest::set_promote() { set_rmw_flags(CEPH_OSD_RMW_FLAG_FORCE_PROMOTE); }
 void OpRequest::set_skip_handle_cache() { set_rmw_flags(CEPH_OSD_RMW_FLAG_SKIP_HANDLE_CACHE); }
 void OpRequest::set_skip_promote() { set_rmw_flags(CEPH_OSD_RMW_FLAG_SKIP_PROMOTE); }
+void OpRequest::set_force_rwordered() { set_rmw_flags(CEPH_OSD_RMW_FLAG_RWORDERED); }
 
 void OpRequest::mark_flag_point(uint8_t flag, const string& s) {
 #ifdef WITH_LTTNG
index 19320366a4152f16f404cef13f563d3c0357dde8..d26e3972cbc5c5deeb86b4c9f8303a9f3e2c7784 100644 (file)
@@ -65,6 +65,8 @@ struct OpRequest : public TrackedOp {
   bool may_read();
   bool may_write();
   bool may_cache();
+  bool rwordered_forced();
+  bool rwordered();
   bool includes_pg_op();
   bool need_read_cap();
   bool need_write_cap();
@@ -80,6 +82,7 @@ struct OpRequest : public TrackedOp {
   void set_promote();
   void set_skip_handle_cache();
   void set_skip_promote();
+  void set_force_rwordered();
 
   struct ClassInfo {
     ClassInfo(const std::string& name, bool read, bool write,
index b2d0a3fc708f75fff67a7990f85e78b63cac0d17..9e72675f9a940e4a7c3baaedffc5c37283bc6274 100644 (file)
@@ -1832,10 +1832,7 @@ void PrimaryLogPG::do_op(OpRequestRef& op)
   }
 
   // order this op as a write?
-  bool write_ordered =
-    op->may_write() ||
-    op->may_cache() ||
-    m->has_flag(CEPH_OSD_FLAG_RWORDERED);
+  bool write_ordered = op->rwordered();
 
   // discard due to cluster full transition?  (we discard any op that
   // originates before the cluster or pool is marked full; the client
index fdd0a7d200740e6c536a70295ad2e3e9a5bfdc4b..f8aeb083fc1b797cc8e0586eda1236d85e302258 100644 (file)
@@ -283,6 +283,7 @@ enum {
   CEPH_OSD_RMW_FLAG_FORCE_PROMOTE   = (1 << 7),
   CEPH_OSD_RMW_FLAG_SKIP_HANDLE_CACHE = (1 << 8),
   CEPH_OSD_RMW_FLAG_SKIP_PROMOTE      = (1 << 9),
+  CEPH_OSD_RMW_FLAG_RWORDERED         = (1 << 10),
 };