From: Jacek J. Lakis Date: Thu, 6 Aug 2015 10:12:57 +0000 (+0200) Subject: handle_op/do_op: Moving couple of checks from dispatcher to parallelized workers X-Git-Tag: v10.0.0~128^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=afcfb050930e2e4086d631119022fd2dee9feb21;p=ceph.git handle_op/do_op: Moving couple of checks from dispatcher to parallelized workers Signed-off-by: Jacek J. Lakis --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 8882980774c9..535b96c97077 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -8093,23 +8093,6 @@ void OSD::handle_op(OpRequestRef& op, OSDMapRef& osdmap) // we don't need encoded payload anymore m->clear_payload(); - // object name too long? - unsigned max_name_len = MIN(g_conf->osd_max_object_name_len, - store->get_max_object_name_length()); - if (m->get_oid().name.size() > max_name_len) { - dout(4) << "handle_op '" << m->get_oid().name << "' is longer than " - << max_name_len << " bytes" << dendl; - service.reply_op_error(op, -ENAMETOOLONG); - return; - } - - // blacklisted? - if (osdmap->is_blacklisted(m->get_source_addr())) { - dout(4) << "handle_op " << m->get_source_addr() << " is blacklisted" << dendl; - service.reply_op_error(op, -EBLACKLISTED); - return; - } - // set up a map send if the Op gets blocked for some reason send_map_on_destruct share_map(this, m, osdmap, m->get_map_epoch()); Session *client_session = @@ -8125,14 +8108,6 @@ void OSD::handle_op(OpRequestRef& op, OSDMapRef& osdmap) client_session->put(); } - if (op->rmw_flags == 0) { - int r = init_op_flags(op); - if (r) { - service.reply_op_error(op, r); - return; - } - } - if (cct->_conf->osd_debug_drop_op_probability > 0 && !m->get_source().is_mds()) { if ((double)rand() / (double)RAND_MAX < cct->_conf->osd_debug_drop_op_probability) { @@ -8144,29 +8119,6 @@ void OSD::handle_op(OpRequestRef& op, OSDMapRef& osdmap) // calc actual pgid pg_t _pgid = m->get_pg(); int64_t pool = _pgid.pool(); - if (op->may_write()) { - const pg_pool_t *pi = osdmap->get_pg_pool(pool); - if (!pi) { - return; - } - - // invalid? - if (m->get_snapid() != CEPH_NOSNAP) { - service.reply_op_error(op, -EINVAL); - return; - } - - // too big? - if (cct->_conf->osd_max_write_size && - m->get_data_len() > ((int64_t)g_conf->osd_max_write_size) << 20) { - // journal can't hold commit! - derr << "handle_op msg data len " << m->get_data_len() - << " > osd_max_write_size " << (cct->_conf->osd_max_write_size << 20) - << " on " << *m << dendl; - service.reply_op_error(op, -OSD_WRITETOOBIG); - return; - } - } if ((m->get_flags() & CEPH_OSD_FLAG_PGOP) == 0 && osdmap->have_pg_pool(pool)) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index d73f350e939e..0ca3d34cd06b 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1482,6 +1482,15 @@ void ReplicatedPG::do_op(OpRequestRef& op) { MOSDOp *m = static_cast(op->get_req()); assert(m->get_type() == CEPH_MSG_OSD_OP); + + if (op->rmw_flags == 0) { + int r = osd->osd->init_op_flags(op); + if (r) { + osd->reply_op_error(op, r); + return; + } + } + if (op->includes_pg_op()) { if (pg_op_must_wait(m)) { wait_for_all_missing(op); @@ -1490,6 +1499,17 @@ void ReplicatedPG::do_op(OpRequestRef& op) return do_pg_op(op); } + // object name too long? + unsigned max_name_len = MIN(g_conf->osd_max_object_name_len, + osd->osd->store->get_max_object_name_length()); + if (m->get_oid().name.size() > max_name_len) { + dout(4) << "do_op '" << m->get_oid().name << "' is longer than " + << max_name_len << " bytes" << dendl; + osd->reply_op_error(op, -ENAMETOOLONG); + return; + } + + // blacklisted? if (get_osdmap()->is_blacklisted(m->get_source_addr())) { dout(10) << "do_op " << m->get_source_addr() << " is blacklisted" << dendl; osd->reply_op_error(op, -EBLACKLISTED); @@ -1514,6 +1534,31 @@ void ReplicatedPG::do_op(OpRequestRef& op) << dendl; return; } + int64_t poolid = get_pgid().pool(); + if (op->may_write()) { + + const pg_pool_t *pi = get_osdmap()->get_pg_pool(poolid); + if (!pi) { + return; + } + + // invalid? + if (m->get_snapid() != CEPH_NOSNAP) { + osd->reply_op_error(op, -EINVAL); + return; + } + + // too big? + if (cct->_conf->osd_max_write_size && + m->get_data_len() > cct->_conf->osd_max_write_size << 20) { + // journal can't hold commit! + derr << "do_op msg data len " << m->get_data_len() + << " > osd_max_write_size " << (cct->_conf->osd_max_write_size << 20) + << " on " << *m << dendl; + osd->reply_op_error(op, -OSD_WRITETOOBIG); + return; + } + } // order this op as a write? bool write_ordered =