From 89fd030bf9436dc4e37cc3a0f935ec077455d9d5 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Sat, 3 Dec 2016 16:05:08 -0800 Subject: [PATCH] OSD::init_op_flags: don't consider PING to be a write Signed-off-by: Samuel Just --- src/osd/OSD.cc | 11 +++++++++-- src/osd/ReplicatedPG.cc | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 2cde841e436..73edafdcff6 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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(); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index db3f1e20cdb..7eaf2d2fb8f 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -5496,6 +5496,9 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& 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; -- 2.47.3