diff --git a/src/librados.cc b/src/librados.cc index 6e402abd7d9..b937e8f1940 100644 --- a/src/librados.cc +++ b/src/librados.cc @@ -1711,7 +1711,7 @@ int librados::RadosClient::operate(IoCtxImpl& io, const object_t& oid, /* can't write to a snapshot */ if (io.snap_seq != CEPH_NOSNAP) - return -EINVAL; + return -EROFS; if (!o->size()) return 0; @@ -1743,10 +1743,6 @@ int librados::RadosClient::operate(IoCtxImpl& io, const object_t& oid, int librados::RadosClient::operate_read(IoCtxImpl& io, const object_t& oid, ::ObjectOperation *o, bufferlist *pbl) { - /* can't write to a snapshot */ - if (io.snap_seq != CEPH_NOSNAP) - return -EINVAL; - if (!o->size()) return 0; @@ -1780,7 +1776,7 @@ int librados::RadosClient::aio_operate(IoCtxImpl& io, const object_t& oid, utime_t ut = ceph_clock_now(cct); /* can't write to a snapshot */ if (io.snap_seq != CEPH_NOSNAP) - return -EINVAL; + return -EROFS; Context *onack = new C_aio_Ack(c); Context *oncommit = new C_aio_Safe(c); @@ -3862,7 +3858,7 @@ extern "C" int rados_getxattrs(rados_ioctx_t io, const char *oid, { RadosXattrsIter *it = new RadosXattrsIter(); if (!it) - return ENOMEM; + return -ENOMEM; librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io; object_t obj(oid); int ret = ctx->client->getxattrs(*ctx, obj, it->attrset); @@ -3895,7 +3891,7 @@ extern "C" int rados_getxattrs_next(rados_xattrs_iter_t iter, size_t bl_len = bl.length(); it->val = (char*)malloc(bl_len); if (!it->val) - return ENOMEM; + return -ENOMEM; memcpy(it->val, bl.c_str(), bl_len); *val = it->val; *len = bl_len; diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 17a0a5cf5fd..e8761959ba5 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -2161,10 +2161,9 @@ bool OSDMonitor::preprocess_pool_op_create(MPoolOp *m) } if ((m->auid && !session->caps.check_privileges(PAXOS_OSDMAP, MON_CAP_W, m->auid)) && !session->caps.check_privileges(PAXOS_OSDMAP, MON_CAP_W)) { - if (session) - dout(5) << "attempt to create new pool without sufficient auid privileges!" - << "message: " << *m << std::endl - << "caps: " << m->get_session()->caps << dendl; + dout(5) << "attempt to create new pool without sufficient auid privileges!" + << "message: " << *m << std::endl + << "caps: " << session->caps << dendl; _pool_op_reply(m, -EPERM, osdmap.get_epoch()); return true; }