paxos_decode(p);
}
- /**
- * These messages are only used by the monitors and clients,
- * and the client doesn't care, so we're creating a monitor-specific
- * function here. Note that this function explicitly exists to bypass
- * the normal ref-counting, so don't expect the returned pointer to be
- * very long-lived -- it will still only last as long as the Session would
- * normally.
- */
- MonSession *get_session() {
- auto priv = get_connection()->get_priv();
- return static_cast<MonSession*>(priv.get());
- }
-
const char *get_type_name() const override { return "PaxosServiceMessage"; }
};
return false;
}
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session) {
mon->reply_command(op, -EACCES, "access denied", rdata, get_last_committed());
return true;
cmd_getval(g_ceph_context, cmdmap, "format", format, string("plain"));
boost::scoped_ptr<Formatter> f(Formatter::create(format));
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session) {
mon->reply_command(op, -EACCES, "access denied", rdata, get_last_committed());
return true;
dout(10) << "preprocess_log " << *m << " from " << m->get_orig_source() << dendl;
int num_new = 0;
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session)
goto done;
if (!session->is_capable("log", MON_CAP_W)) {
mon->reply_command(op, -EINVAL, rs, get_last_committed());
return true;
}
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session) {
mon->reply_command(op, -EACCES, "access denied", get_last_committed());
return true;
string prefix;
cmd_getval(g_ceph_context, cmdmap, "prefix", prefix);
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session) {
mon->reply_command(op, -EACCES, "access denied", get_last_committed());
return true;
const auto &fsmap = get_fsmap();
// check privileges, ignore if fails
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session)
goto ignore;
if (!session->is_capable("mds", MON_CAP_X)) {
const auto &fsmap = get_fsmap();
// check privileges, ignore message if fails
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session)
goto ignore;
if (!session->is_capable("mds", MON_CAP_X)) {
cmd_getval(g_ceph_context, cmdmap, "format", format, string("plain"));
std::unique_ptr<Formatter> f(Formatter::create(format));
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session) {
mon->reply_command(op, -EACCES, "access denied", rdata, get_last_committed());
return true;
cmd_getval(g_ceph_context, cmdmap, "prefix", prefix);
/* Refuse access if message not associated with a valid session */
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session) {
mon->reply_command(op, -EACCES, "access denied", rdata, get_last_committed());
return true;
return true;
}
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session) {
mon->reply_command(op, -EACCES, "access denied", rdata,
get_last_committed());
return true;
}
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session) {
mon->reply_command(op, -EACCES, "access denied", rdata, get_last_committed());
return true;
{
op->mark_pgmon_event(__func__);
auto m = static_cast<MGetPoolStats*>(op->get_req());
- auto session = m->get_session();
+ auto session = op->get_session();
if (!session)
return true;
if (!session->is_capable("pg", MON_CAP_R)) {
{
op->mark_pgmon_event(__func__);
auto statfs = static_cast<MStatfs*>(op->get_req());
- auto session = statfs->get_session();
+ auto session = op->get_session();
if (!session)
return true;
string prefix;
cmd_getval(g_ceph_context, cmdmap, "prefix", prefix);
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session) {
mon->reply_command(op, -EACCES, "access denied", get_last_committed());
return true;
string prefix;
cmd_getval(g_ceph_context, cmdmap, "prefix", prefix);
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session) {
mon->reply_command(op, -EACCES, "access denied", get_last_committed());
return true;
MMonJoin *join = static_cast<MMonJoin*>(op->get_req());
dout(10) << __func__ << " " << join->name << " at " << join->addr << dendl;
- MonSession *session = join->get_session();
+ MonSession *session = op->get_session();
if (!session ||
!session->is_capable("mon", MON_CAP_W | MON_CAP_X)) {
dout(10) << " insufficient caps" << dendl;
MMonGetOSDMap *m = static_cast<MMonGetOSDMap*>(op->get_req());
uint64_t features = mon->get_quorum_con_features();
- if (m->get_session() && m->get_session()->con_features)
- features = m->get_session()->con_features;
+ if (op->get_session() && op->get_session()->con_features)
+ features = op->get_session()->con_features;
dout(10) << __func__ << " " << *m << dendl;
MOSDMap *reply = new MOSDMap(mon->monmap->fsid, features);
// failure --
-bool OSDMonitor::check_source(PaxosServiceMessage *m, uuid_d fsid) {
+bool OSDMonitor::check_source(MonOpRequestRef op, uuid_d fsid) {
// check permissions
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session)
return true;
if (!session->is_capable("osd", MON_CAP_X)) {
int badboy = m->get_target_osd();
// check permissions
- if (check_source(m, m->fsid))
+ if (check_source(op, m->fsid))
goto didit;
// first, verify the reporting host is valid
int from = m->target_osd;
// check permissions
- if (check_source(m, m->fsid))
+ if (check_source(op, m->fsid))
goto reply;
// first, verify the reporting host is valid
int from = m->get_orig_source_inst().name.num();
// check permissions, ignore if failed (no response expected)
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session)
goto ignore;
if (!session->is_capable("osd", MON_CAP_X)) {
unsigned mask = CEPH_OSD_NEARFULL | CEPH_OSD_BACKFILLFULL | CEPH_OSD_FULL;
// check permissions, ignore if failed
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session)
goto ignore;
if (!session->is_capable("osd", MON_CAP_X)) {
int from = m->get_orig_source().num();
// check permissions, ignore if failed
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session)
goto ignore;
if (!session->is_capable("osd", MON_CAP_X)) {
op->mark_osdmon_event(__func__);
auto m = static_cast<MOSDPGCreated*>(op->get_req());
dout(10) << __func__ << " " << *m << dendl;
- auto session = m->get_session();
+ auto session = op->get_session();
mon->no_reply(op);
if (!session) {
dout(10) << __func__ << ": no monitor session!" << dendl;
auto m = static_cast<MOSDPGReadyToMerge*>(op->get_req());
dout(10) << __func__ << " " << *m << dendl;
const pg_pool_t *pi;
- auto session = m->get_session();
+ auto session = op->get_session();
if (!session) {
dout(10) << __func__ << ": no monitor session!" << dendl;
goto ignore;
size_t ignore_cnt = 0;
// check caps
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session)
goto ignore;
if (!session->is_capable("osd", MON_CAP_X)) {
dout(7) << "preprocess_remove_snaps " << *m << dendl;
// check privilege, ignore if failed
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session)
goto ignore;
if (!session->caps.is_capable(
bool OSDMonitor::preprocess_beacon(MonOpRequestRef op)
{
op->mark_osdmon_event(__func__);
- auto beacon = static_cast<MOSDBeacon*>(op->get_req());
// check caps
- auto session = beacon->get_session();
+ auto session = op->get_session();
mon->no_reply(op);
if (!session) {
dout(10) << __func__ << " no monitor session!" << dendl;
return true;
}
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session) {
+ derr << __func__ << " no session" << dendl;
mon->reply_command(op, -EACCES, "access denied", get_last_committed());
return true;
}
op->mark_osdmon_event(__func__);
MPoolOp *m = static_cast<MPoolOp*>(op->get_req());
dout(10) << "prepare_new_pool from " << m->get_connection() << dendl;
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session)
return -EPERM;
string erasure_code_profile;
return true;
}
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session) {
+ derr << __func__ << " no session" << dendl;
mon->reply_command(op, -EACCES, "access denied", get_last_committed());
return true;
}
op->mark_osdmon_event(__func__);
MPoolOp *m = static_cast<MPoolOp*>(op->get_req());
- MonSession *session = m->get_session();
+ MonSession *session = op->get_session();
if (!session) {
_pool_op_reply(op, -EPERM, osdmap.get_epoch());
return true;
private:
void print_utilization(ostream &out, Formatter *f, bool tree) const;
- bool check_source(PaxosServiceMessage *m, uuid_d fsid);
+ bool check_source(MonOpRequestRef op, uuid_d fsid);
bool preprocess_get_osdmap(MonOpRequestRef op);