From: Samuel Just Date: Tue, 20 Dec 2016 17:47:41 +0000 (-0800) Subject: osd/: treat PINGs as RWORDERED X-Git-Tag: v11.1.1~6^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F12590%2Fhead;p=ceph.git 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index a5963412e0db..ac34033e6bb5 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 2b8d75d858d6..0e51d5c419ff 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 19320366a415..d26e3972cbc5 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 b2d0a3fc708f..9e72675f9a94 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 fdd0a7d20074..f8aeb083fc1b 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), };