From 78ede90c4e9c1fa3f3ddaf84b3e15584e8ea0ef5 Mon Sep 17 00:00:00 2001 From: John Spray Date: Wed, 19 Mar 2014 11:21:21 +0000 Subject: [PATCH] objecter: waive OSDMAP_FULL check for MDS The MDS expects to be able to perform writes to OSDs even if the full ratio has been reached, in order to journal file deletions to free space. Fixes: #7780 Signed-off-by: John Spray --- src/osdc/Objecter.cc | 25 ++++++++++++++++++------- src/osdc/Objecter.h | 1 + 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index a2954662605cf..08d16e1406456 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -567,7 +567,7 @@ void Objecter::handle_osd_map(MOSDMap *m) } bool was_pauserd = osdmap->test_flag(CEPH_OSDMAP_PAUSERD); - bool was_full = osdmap->test_flag(CEPH_OSDMAP_FULL); + bool was_full = osdmap_full_flag(); bool was_pausewr = osdmap->test_flag(CEPH_OSDMAP_PAUSEWR) || was_full; list need_resend_linger; @@ -618,7 +618,7 @@ void Objecter::handle_osd_map(MOSDMap *m) } logger->set(l_osdc_map_epoch, osdmap->get_epoch()); - was_full = was_full || osdmap->test_flag(CEPH_OSDMAP_FULL); + was_full = was_full || osdmap_full_flag(); scan_requests(skipped_map, was_full, need_resend, need_resend_linger, need_resend_command); @@ -655,7 +655,7 @@ void Objecter::handle_osd_map(MOSDMap *m) } bool pauserd = osdmap->test_flag(CEPH_OSDMAP_PAUSERD); - bool pausewr = osdmap->test_flag(CEPH_OSDMAP_PAUSEWR) || osdmap->test_flag(CEPH_OSDMAP_FULL); + bool pausewr = osdmap->test_flag(CEPH_OSDMAP_PAUSEWR) || osdmap_full_flag(); // was/is paused? if (was_pauserd || was_pausewr || pauserd || pausewr) @@ -1021,7 +1021,7 @@ void Objecter::_get_latest_version(epoch_t oldest, epoch_t newest, Context *fin) void Objecter::maybe_request_map() { int flag = 0; - if (osdmap->test_flag(CEPH_OSDMAP_FULL)) { + if (osdmap_full_flag()) { ldout(cct, 10) << "maybe_request_map subscribing (continuous) to next osd map (FULL flag is set)" << dendl; } else { ldout(cct, 10) << "maybe_request_map subscribing (onetime) to next osd map" << dendl; @@ -1328,8 +1328,7 @@ tid_t Objecter::_op_submit(Op *op) ldout(cct, 10) << " paused read " << op << " tid " << last_tid << dendl; op->paused = true; maybe_request_map(); - } else if ((op->flags & CEPH_OSD_FLAG_WRITE) && - osdmap->test_flag(CEPH_OSDMAP_FULL)) { + } else if ((op->flags & CEPH_OSD_FLAG_WRITE) && osdmap_full_flag()) { ldout(cct, 0) << " FULL, paused modify " << op << " tid " << last_tid << dendl; op->paused = true; maybe_request_map(); @@ -1395,12 +1394,24 @@ bool Objecter::is_pg_changed( bool Objecter::op_should_be_paused(Op *op) { bool pauserd = osdmap->test_flag(CEPH_OSDMAP_PAUSERD); - bool pausewr = osdmap->test_flag(CEPH_OSDMAP_PAUSEWR) || osdmap->test_flag(CEPH_OSDMAP_FULL); + bool pausewr = osdmap->test_flag(CEPH_OSDMAP_PAUSEWR) || osdmap_full_flag(); return (op->flags & CEPH_OSD_FLAG_READ && pauserd) || (op->flags & CEPH_OSD_FLAG_WRITE && pausewr); } + +/** + * Wrapper around osdmap->test_flag for special handling of the FULL flag. + */ +bool Objecter::osdmap_full_flag() const +{ + // Ignore the FULL flag if we are working on behalf of an MDS, in order to permit + // MDS journal writes for file deletions. + return osdmap->test_flag(CEPH_OSDMAP_FULL) && (messenger->get_myname().type() != entity_name_t::TYPE_MDS); +} + + int64_t Objecter::get_object_hash_position(int64_t pool, const string& key, const string& ns) { diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 2311f55ce3676..df5b5d77e03a3 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1463,6 +1463,7 @@ public: RECALC_OP_TARGET_OSD_DNE, RECALC_OP_TARGET_OSD_DOWN, }; + bool osdmap_full_flag() const; bool op_should_be_paused(Op *op); int recalc_op_target(Op *op); bool recalc_linger_op_target(LingerOp *op); -- 2.39.5