]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD::init_op_flags: don't consider PING to be a write
authorSamuel Just <sjust@redhat.com>
Sun, 4 Dec 2016 00:05:08 +0000 (16:05 -0800)
committerSamuel Just <sjust@redhat.com>
Sun, 4 Dec 2016 00:05:08 +0000 (16:05 -0800)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/OSD.cc
src/osd/ReplicatedPG.cc

index 2cde841e4368c17a734a5d95f9ef86727590f519..73edafdcff619e711eab0307653e6859acc18743 100644 (file)
@@ -9262,8 +9262,15 @@ 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 (ceph_osd_op_mode_modify(iter->op.op))
-      op->set_write();
+    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
+       */
+      if (ceph_osd_op_mode_modify(iter->op.op))
+       op->set_write();
+    }
     if (ceph_osd_op_mode_read(iter->op.op))
       op->set_read();
 
index db3f1e20cdb91ca917420a4bdf1640da5ee1060e..7eaf2d2fb8f3e3b414aa4ec4448aadd3c9eba30a 100644 (file)
@@ -5496,6 +5496,9 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
          dout(10) << " found existing watch " << w << " by " << entity << dendl;
          ctx->watch_connects.push_back(make_pair(w, true));
         } else if (op.watch.op == CEPH_OSD_WATCH_OP_PING) {
+         /* Note: WATCH with PING doesn't cause may_write() to return true,
+          * so if there is nothing else in the transaction, this is going
+          * to run do_osd_op_effects, but not write out a log entry */
          if (!oi.watchers.count(make_pair(cookie, entity))) {
            result = -ENOTCONN;
            break;