From 3a2ed3b136de68192f661b6992cbb96ce6aafd20 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 20 Dec 2016 09:47:41 -0800 Subject: [PATCH] osd/: treat PINGs as RWORDERED 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 --- src/osd/OSD.cc | 9 +++++++-- src/osd/OpRequest.cc | 6 ++++++ src/osd/OpRequest.h | 3 +++ src/osd/PrimaryLogPG.cc | 5 +---- src/osd/osd_types.h | 1 + 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index a5963412e0d..ac34033e6bb 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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(); } diff --git a/src/osd/OpRequest.cc b/src/osd/OpRequest.cc index 2b8d75d858d..0e51d5c419f 100644 --- a/src/osd/OpRequest.cc +++ b/src/osd/OpRequest.cc @@ -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 diff --git a/src/osd/OpRequest.h b/src/osd/OpRequest.h index 19320366a41..d26e3972cbc 100644 --- a/src/osd/OpRequest.h +++ b/src/osd/OpRequest.h @@ -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, diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index b2d0a3fc708..9e72675f9a9 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -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 diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index fdd0a7d2007..f8aeb083fc1 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -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), }; -- 2.39.5