summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ceph.spec.in3
-rwxr-xr-xqa/workunits/mon/caps.sh55
-rwxr-xr-xsrc/ceph.in7
-rw-r--r--src/cls/replica_log/cls_replica_log_types.h2
-rw-r--r--src/cls/rgw/cls_rgw_client.cc2
-rw-r--r--src/common/Cond.h32
-rw-r--r--src/common/Finisher.cc6
-rw-r--r--src/mon/MonCap.cc14
-rw-r--r--src/mon/Monitor.cc7
-rw-r--r--src/mon/OSDMonitor.cc98
-rw-r--r--src/mon/OSDMonitor.h5
-rw-r--r--src/mon/PGMonitor.cc2
-rw-r--r--src/mon/PaxosService.h5
-rw-r--r--src/os/FileJournal.cc7
-rw-r--r--src/os/FileStore.cc6
-rw-r--r--src/osd/OSD.cc23
-rw-r--r--src/osd/OSD.h40
-rw-r--r--src/rgw/rgw_admin.cc25
-rw-r--r--src/rgw/rgw_bucket.cc36
-rw-r--r--src/rgw/rgw_metadata.cc12
-rw-r--r--src/rgw/rgw_op.cc3
-rw-r--r--src/rgw/rgw_op.h52
-rw-r--r--src/rgw/rgw_rados.cc25
-rw-r--r--src/rgw/rgw_rados.h6
-rw-r--r--src/rgw/rgw_rest.cc4
-rw-r--r--src/rgw/rgw_rest_bucket.cc14
-rw-r--r--src/rgw/rgw_rest_config.h2
-rw-r--r--src/rgw/rgw_rest_log.h30
-rw-r--r--src/rgw/rgw_rest_metadata.cc4
-rw-r--r--src/rgw/rgw_rest_metadata.h12
-rw-r--r--src/rgw/rgw_rest_opstate.h8
-rw-r--r--src/rgw/rgw_rest_replica_log.h18
-rw-r--r--src/rgw/rgw_rest_s3.cc3
-rw-r--r--src/rgw/rgw_rest_usage.cc4
-rw-r--r--src/rgw/rgw_rest_user.cc22
-rw-r--r--src/rgw/rgw_swift_auth.h2
-rw-r--r--src/test/cls_version/test_cls_version.cc2
37 files changed, 348 insertions, 250 deletions
diff --git a/ceph.spec.in b/ceph.spec.in
index 6ee1c861fee..4365eb55eb0 100644
--- a/ceph.spec.in
+++ b/ceph.spec.in
@@ -146,6 +146,7 @@ managers such as Pacemaker.
Summary: RADOS distributed object store client library
Group: System Environment/Libraries
License: LGPL-2.0
+Obsoletes: ceph-libs
%description -n librados2
RADOS is a reliable, autonomic distributed object storage cluster
developed as part of the Ceph distributed storage system. This is a
@@ -156,6 +157,7 @@ store using a simple file-like interface.
Summary: RADOS block device client library
Group: System Environment/Libraries
License: LGPL-2.0
+Obsoletes: ceph-libs
%description -n librbd1
RBD is a block device striped across multiple distributed objects in
RADOS, a reliable, autonomic distributed object storage cluster
@@ -166,6 +168,7 @@ shared library allowing applications to manage these block devices.
Summary: Ceph distributed file system client library
Group: System Environment/Libraries
License: LGPL-2.0
+Obsoletes: ceph-libs
%description -n libcephfs1
Ceph is a distributed network file system designed to provide excellent
performance, reliability, and scalability. This is a shared library
diff --git a/qa/workunits/mon/caps.sh b/qa/workunits/mon/caps.sh
new file mode 100755
index 00000000000..f5aebbbb9f4
--- /dev/null
+++ b/qa/workunits/mon/caps.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+tmp=/tmp/cephtest-mon-caps-madness
+
+exit_on_error=1
+
+[[ ! -z $TEST_EXIT_ON_ERROR ]] && exit_on_error=$TEST_EXIT_ON_ERROR
+
+expect()
+{
+ cmd=$1
+ expected_ret=$2
+
+ echo $cmd
+ eval $cmd >&/dev/null
+ ret=$?
+
+ if [[ $ret -ne $expected_ret ]]; then
+ echo "Error: Expected return $expected_ret, got $ret"
+ [[ $exit_on_error -eq 1 ]] && exit 1
+ return 1
+ fi
+
+ return 0
+}
+
+expect "ceph auth get-or-create client.bazar > $tmp.bazar.keyring" 0
+expect "ceph -k $tmp.bazar.keyring --user bazar mon_status" 13
+ceph auth del client.bazar
+
+c="'allow command \"auth list\", allow command mon_status'"
+expect "ceph auth get-or-create client.foo mon $c > $tmp.foo.keyring" 0
+expect "ceph -k $tmp.foo.keyring --user foo mon_status" 0
+expect "ceph -k $tmp.foo.keyring --user foo auth list" 0
+expect "ceph -k $tmp.foo.keyring --user foo auth export" 13
+expect "ceph -k $tmp.foo.keyring --user foo auth del client.bazar" 13
+expect "ceph -k $tmp.foo.keyring --user foo osd dump" 13
+expect "ceph -k $tmp.foo.keyring --user foo pg dump" 13
+expect "ceph -k $tmp.foo.keyring --user foo quorum_status" 13
+ceph auth del client.foo
+
+c="'allow command service with prefix=list, allow command mon_status'"
+expect "ceph auth get-or-create client.bar mon $c > $tmp.bar.keyring" 0
+expect "ceph -k $tmp.bar.keyring --user bar mon_status" 0
+expect "ceph -k $tmp.bar.keyring --user bar auth list" 13
+expect "ceph -k $tmp.bar.keyring --user bar auth export" 13
+expect "ceph -k $tmp.bar.keyring --user bar auth del client.foo" 13
+expect "ceph -k $tmp.bar.keyring --user bar osd dump" 13
+expect "ceph -k $tmp.bar.keyring --user bar pg dump" 13
+expect "ceph -k $tmp.bar.keyring --user bar quorum_status" 13
+ceph auth del client.bar
+
+rm $tmp.bazar.keyring $tmp.foo.keyring $tmp.bar.keyring
+
+echo OK \ No newline at end of file
diff --git a/src/ceph.in b/src/ceph.in
index 6ba92c99b18..dbb7fb5a8cd 100755
--- a/src/ceph.in
+++ b/src/ceph.in
@@ -118,6 +118,8 @@ def parse_cmdargs(args=None, target=''):
parser.add_argument('--admin-daemon', dest='admin_socket',
help='submit admin-socket commands (\"help\" for help')
+ parser.add_argument('--admin-socket', dest='admin_socket_nope',
+ help='you probably mean --admin-daemon')
parser.add_argument('-s', '--status', action='store_true',
help='show cluster status')
@@ -489,6 +491,11 @@ def main():
global verbose
verbose = parsed_args.verbose
+ if parsed_args.admin_socket_nope:
+ print >> sys.stderr, '--admin-socket is used by daemons; '\
+ 'you probably mean --admin-daemon/daemon'
+ return 1
+
# pass on --id, --name, --conf
name = 'client.admin'
if parsed_args.client_id:
diff --git a/src/cls/replica_log/cls_replica_log_types.h b/src/cls/replica_log/cls_replica_log_types.h
index acd55dde533..6056f8e4468 100644
--- a/src/cls/replica_log/cls_replica_log_types.h
+++ b/src/cls/replica_log/cls_replica_log_types.h
@@ -61,7 +61,7 @@ struct cls_replica_log_progress_marker {
position_time(time) {}
cls_replica_log_progress_marker(const string& entity, const string& marker,
const utime_t& time,
- const std::list<cls_replica_log_item_marker> b) :
+ const std::list<cls_replica_log_item_marker>& b) :
entity_id(entity), position_marker(marker),
position_time(time),
items(b) {}
diff --git a/src/cls/rgw/cls_rgw_client.cc b/src/cls/rgw/cls_rgw_client.cc
index 291ca705d7b..165ca437987 100644
--- a/src/cls/rgw/cls_rgw_client.cc
+++ b/src/cls/rgw/cls_rgw_client.cc
@@ -187,8 +187,8 @@ int cls_rgw_bi_log_list(IoCtx& io_ctx, string& oid, string& marker, uint32_t max
int cls_rgw_bi_log_trim(IoCtx& io_ctx, string& oid, string& start_marker, string& end_marker)
{
- int r;
do {
+ int r;
bufferlist in, out;
cls_rgw_bi_log_trim_op call;
call.start_marker = start_marker;
diff --git a/src/common/Cond.h b/src/common/Cond.h
index ee95a65b5b6..e6a13ae48bb 100644
--- a/src/common/Cond.h
+++ b/src/common/Cond.h
@@ -156,4 +156,36 @@ public:
}
};
+/**
+ * Context providing a simple wait() mechanism to wait for completion
+ *
+ * The context will not be deleted as part of complete and must live
+ * until wait() returns.
+ */
+class C_SaferCond : public Context {
+ Mutex lock; ///< Mutex to take
+ Cond cond; ///< Cond to signal
+ bool done; ///< true after finish() has been called
+ int rval; ///< return value
+public:
+ C_SaferCond() : lock("C_SaferCond"), done(false), rval(0) {}
+ void finish(int r) { complete(r); }
+
+ /// We overload complete in order to not delete the context
+ void complete(int r) {
+ Mutex::Locker l(lock);
+ done = true;
+ rval = r;
+ cond.Signal();
+ }
+
+ /// Returns rval once the Context is called
+ int wait() {
+ Mutex::Locker l(lock);
+ while (!done)
+ cond.Wait(lock);
+ return rval;
+ }
+};
+
#endif
diff --git a/src/common/Finisher.cc b/src/common/Finisher.cc
index 72bfb6f9aa7..a1462a184d9 100644
--- a/src/common/Finisher.cc
+++ b/src/common/Finisher.cc
@@ -53,13 +53,11 @@ void *Finisher::finisher_thread_entry()
p != ls.end();
++p) {
if (*p) {
- (*p)->finish(0);
- delete *p;
+ (*p)->complete(0);
} else {
assert(!ls_rval.empty());
Context *c = ls_rval.front().first;
- c->finish(ls_rval.front().second);
- delete c;
+ c->complete(ls_rval.front().second);
ls_rval.pop_front();
}
if (logger)
diff --git a/src/mon/MonCap.cc b/src/mon/MonCap.cc
index 1114ca3b9da..8e35b775247 100644
--- a/src/mon/MonCap.cc
+++ b/src/mon/MonCap.cc
@@ -261,15 +261,21 @@ bool MonCap::is_capable(CephContext *cct,
if (cct)
ldout(cct, 20) << " allow so far " << allow << ", doing grant " << *p << dendl;
- if (p->is_allow_all())
+ if (p->is_allow_all()) {
+ if (cct)
+ ldout(cct, 20) << " allow all" << dendl;
return true;
+ }
// check enumerated caps
allow = allow | p->get_allowed(cct, name, service, command, command_args);
- if (!((op_may_read && !(allow & MON_CAP_R)) ||
- (op_may_write && !(allow & MON_CAP_W)) ||
- (op_may_exec && !(allow & MON_CAP_X))))
+ if ((!op_may_read || (allow & MON_CAP_R)) &&
+ (!op_may_write || (allow & MON_CAP_W)) &&
+ (!op_may_exec || (allow & MON_CAP_X))) {
+ if (cct)
+ ldout(cct, 20) << " match" << dendl;
return true;
+ }
}
return false;
}
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc
index 90750dd7b11..7e484e8db6b 100644
--- a/src/mon/Monitor.cc
+++ b/src/mon/Monitor.cc
@@ -1523,8 +1523,10 @@ bool Monitor::_allowed_command(MonSession *s, map<string, cmd_vartype>& cmd)
{
bool retval = false;
- if (s->caps.is_allow_all())
+ if (s->caps.is_allow_all()) {
+ dout(10) << __func__ << " allow_all" << dendl;
return true;
+ }
string prefix;
cmd_getval(g_ceph_context, cmd, "prefix", prefix);
@@ -1538,10 +1540,11 @@ bool Monitor::_allowed_command(MonSession *s, map<string, cmd_vartype>& cmd)
}
if (s->caps.is_capable(g_ceph_context, s->inst.name,
- "", prefix, strmap, false, false, false)) {
+ "", prefix, strmap, false, false, true)) {
retval = true;
}
+ dout(10) << __func__ << " = " << retval << dendl;
return retval;
}
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index c8baac58c83..20e4eac88cb 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -185,8 +185,11 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap)
mon->pgmon()->check_osd_map(osdmap.epoch);
}
- update_logger();
+ check_subs();
+
share_map_with_random_osd();
+ update_logger();
+
process_failures();
// make sure our feature bits reflect the latest map
@@ -294,9 +297,6 @@ void OSDMonitor::on_active()
{
update_logger();
- send_to_waiting();
- check_subs();
-
if (thrash_map) {
if (mon->is_leader()) {
if (thrash())
@@ -310,22 +310,25 @@ void OSDMonitor::on_active()
mon->clog.info() << "osdmap " << osdmap << "\n";
if (!mon->is_leader()) {
- kick_all_failures();
+ list<MOSDFailure*> ls;
+ take_all_failures(ls);
+ while (!ls.empty()) {
+ dispatch(ls.front());
+ ls.pop_front();
+ }
}
}
void OSDMonitor::on_shutdown()
{
dout(10) << __func__ << dendl;
- map<epoch_t, list<PaxosServiceMessage*> >::iterator p = waiting_for_map.begin();
- while (p != waiting_for_map.end()) {
- while (!p->second.empty()) {
- Message *m = p->second.front();
- dout(20) << " discarding " << m << " " << *m << dendl;
- m->put();
- p->second.pop_front();
- }
- waiting_for_map.erase(p++);
+
+ // discard failure info, waiters
+ list<MOSDFailure*> ls;
+ take_all_failures(ls);
+ while (!ls.empty()) {
+ ls.front()->put();
+ ls.pop_front();
}
}
@@ -1049,23 +1052,16 @@ void OSDMonitor::process_failures()
}
}
-void OSDMonitor::kick_all_failures()
+void OSDMonitor::take_all_failures(list<MOSDFailure*>& ls)
{
- dout(10) << "kick_all_failures on " << failure_info.size() << " osds" << dendl;
- assert(!mon->is_leader());
+ dout(10) << __func__ << " on " << failure_info.size() << " osds" << dendl;
- list<MOSDFailure*> ls;
for (map<int,failure_info_t>::iterator p = failure_info.begin();
p != failure_info.end();
++p) {
p->second.take_report_messages(ls);
}
failure_info.clear();
-
- while (!ls.empty()) {
- dispatch(ls.front());
- ls.pop_front();
- }
}
@@ -1311,7 +1307,6 @@ void OSDMonitor::_reply_map(PaxosServiceMessage *m, epoch_t e)
{
dout(7) << "_reply_map " << e
<< " from " << m->get_orig_source_inst()
- << " for " << m
<< dendl;
send_latest(m, e);
}
@@ -1450,53 +1445,15 @@ bool OSDMonitor::prepare_remove_snaps(MRemoveSnaps *m)
// ---------------
// map helpers
-void OSDMonitor::send_to_waiting()
-{
- dout(10) << "send_to_waiting " << osdmap.get_epoch() << dendl;
-
- map<epoch_t, list<PaxosServiceMessage*> >::iterator p = waiting_for_map.begin();
- while (p != waiting_for_map.end()) {
- epoch_t from = p->first;
-
- if (from) {
- if (from <= osdmap.get_epoch()) {
- while (!p->second.empty()) {
- send_incremental(p->second.front(), from);
- p->second.front()->put();
- p->second.pop_front();
- }
- } else {
- dout(10) << "send_to_waiting from " << from << dendl;
- ++p;
- continue;
- }
- } else {
- while (!p->second.empty()) {
- send_full(p->second.front());
- p->second.front()->put();
- p->second.pop_front();
- }
- }
-
- waiting_for_map.erase(p++);
- }
-}
-
void OSDMonitor::send_latest(PaxosServiceMessage *m, epoch_t start)
{
- if (is_readable()) {
- dout(5) << "send_latest to " << m->get_orig_source_inst()
- << " start " << start << dendl;
- if (start == 0)
- send_full(m);
- else
- send_incremental(m, start);
- m->put();
- } else {
- dout(5) << "send_latest to " << m->get_orig_source_inst()
- << " start " << start << " later" << dendl;
- waiting_for_map[start].push_back(m);
- }
+ dout(5) << "send_latest to " << m->get_orig_source_inst()
+ << " start " << start << dendl;
+ if (start == 0)
+ send_full(m);
+ else
+ send_incremental(m, start);
+ m->put();
}
@@ -1651,6 +1608,7 @@ epoch_t OSDMonitor::blacklist(const entity_addr_t& a, utime_t until)
void OSDMonitor::check_subs()
{
+ dout(10) << __func__ << dendl;
string type = "osdmap";
if (mon->session_map.subs.count(type) == 0)
return;
@@ -1664,6 +1622,8 @@ void OSDMonitor::check_subs()
void OSDMonitor::check_sub(Subscription *sub)
{
+ dout(10) << __func__ << " " << sub << " next " << sub->next
+ << (sub->onetime ? " (onetime)":" (ongoing)") << dendl;
if (sub->next <= osdmap.get_epoch()) {
if (sub->next >= 1)
send_incremental(sub->next, sub->session->inst, sub->incremental_onetime);
diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h
index d6553228321..d7cb8fdf369 100644
--- a/src/mon/OSDMonitor.h
+++ b/src/mon/OSDMonitor.h
@@ -118,8 +118,6 @@ public:
OSDMap osdmap;
private:
- map<epoch_t, list<PaxosServiceMessage*> > waiting_for_map;
-
// [leader]
OSDMap::Incremental pending_inc;
map<int, failure_info_t> failure_info;
@@ -192,7 +190,6 @@ private:
bool can_mark_in(int o);
// ...
- void send_to_waiting(); // send current map to waiters.
MOSDMap *build_latest_full();
MOSDMap *build_incremental(epoch_t first, epoch_t last);
void send_full(PaxosServiceMessage *m);
@@ -212,7 +209,7 @@ private:
bool prepare_failure(class MOSDFailure *m);
bool prepare_mark_me_down(class MOSDMarkMeDown *m);
void process_failures();
- void kick_all_failures();
+ void take_all_failures(list<MOSDFailure*>& ls);
bool preprocess_boot(class MOSDBoot *m);
bool prepare_boot(class MOSDBoot *m);
diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc
index 1f11d5486cf..648a8fe2384 100644
--- a/src/mon/PGMonitor.cc
+++ b/src/mon/PGMonitor.cc
@@ -1794,8 +1794,8 @@ void PGMonitor::get_health(list<pair<health_status_t,string> >& summary,
ss << sum << " requests are blocked > " << g_conf->mon_osd_max_op_age << " sec";
summary.push_back(make_pair(HEALTH_WARN, ss.str()));
- unsigned num_slow_osds = 0;
if (detail) {
+ unsigned num_slow_osds = 0;
// do per-osd warnings
for (hash_map<int32_t,osd_stat_t>::const_iterator p = pg_map.osd_stat.begin();
p != pg_map.osd_stat.end();
diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h
index a5761d19ad8..74d5a90494c 100644
--- a/src/mon/PaxosService.h
+++ b/src/mon/PaxosService.h
@@ -438,8 +438,9 @@ public:
/**
* This is called when the Paxos state goes to active.
*
- * @remarks It's a courtesy method, in case the class implementing this
- * service has anything it wants/needs to do at that time.
+ * On the peon, this is after each election.
+ * On the leader, this is after each election, *and* after each completed
+ * proposal.
*
* @note This function may get called twice in certain recovery cases.
*/
diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc
index 3acadf09582..4a2af08dd4c 100644
--- a/src/os/FileJournal.cc
+++ b/src/os/FileJournal.cc
@@ -299,11 +299,10 @@ int FileJournal::_open_file(int64_t oldsize, blksize_t blksize,
return -err;
}
ret = ::posix_fallocate(fd, 0, newsize);
- if (ret < 0) {
- int err = errno;
+ if (ret) {
derr << "FileJournal::_open_file : unable to preallocation journal to "
- << newsize << " bytes: " << cpp_strerror(err) << dendl;
- return -err;
+ << newsize << " bytes: " << cpp_strerror(ret) << dendl;
+ return -ret;
}
max_size = newsize;
}
diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc
index 1363eff27d1..10f2b1f2aad 100644
--- a/src/os/FileStore.cc
+++ b/src/os/FileStore.cc
@@ -2028,8 +2028,7 @@ void FileStore::_finish_op(OpSequencer *osr)
logger->tinc(l_os_apply_lat, lat);
if (o->onreadable_sync) {
- o->onreadable_sync->finish(0);
- delete o->onreadable_sync;
+ o->onreadable_sync->complete(0);
}
op_finisher.queue(o->onreadable);
delete o;
@@ -2126,8 +2125,7 @@ int FileStore::queue_transactions(Sequencer *posr, list<Transaction*> &tls,
// start on_readable finisher after we queue journal item, as on_readable callback
// is allowed to delete the Transaction
if (onreadable_sync) {
- onreadable_sync->finish(r);
- delete onreadable_sync;
+ onreadable_sync->complete(r);
}
op_finisher.queue(onreadable, r);
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index 1ee4c09a63e..464ed770df2 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -1728,7 +1728,7 @@ PG* OSD::_make_pg(
PG *pg;
hobject_t logoid = make_pg_log_oid(pgid);
hobject_t infooid = make_pg_biginfo_oid(pgid);
- if (osdmap->get_pg_type(pgid) == pg_pool_t::TYPE_REP)
+ if (createmap->get_pg_type(pgid) == pg_pool_t::TYPE_REP)
pg = new ReplicatedPG(&service, createmap, pool, pgid, logoid, infooid);
else
assert(0);
@@ -3267,21 +3267,30 @@ bool remove_dir(
}
t->remove(coll, *i);
if (num >= g_conf->osd_target_transaction_size) {
- store->apply_transaction(osr, *t);
+ C_SaferCond waiter;
+ store->queue_transaction(osr, t, &waiter);
+ bool cont = dstate->pause_clearing();
+ waiter.wait();
+ if (cont)
+ cont = dstate->resume_clearing();
delete t;
- if (!dstate->check_canceled()) {
- // canceled!
+ if (!cont)
return false;
- }
t = new ObjectStore::Transaction;
num = 0;
}
}
olist.clear();
}
- store->apply_transaction(osr, *t);
+
+ C_SaferCond waiter;
+ store->queue_transaction(osr, t, &waiter);
+ bool cont = dstate->pause_clearing();
+ waiter.wait();
+ if (cont)
+ cont = dstate->resume_clearing();
delete t;
- return true;
+ return cont;
}
void OSD::RemoveWQ::_process(pair<PGRef, DeletingStateRef> item)
diff --git a/src/osd/OSD.h b/src/osd/OSD.h
index 238c5b43594..04ad4dcd7d7 100644
--- a/src/osd/OSD.h
+++ b/src/osd/OSD.h
@@ -148,6 +148,7 @@ class DeletingState {
enum {
QUEUED,
CLEARING_DIR,
+ CLEARING_WAITING,
DELETING_DIR,
DELETED_DIR,
CANCELED,
@@ -160,8 +161,23 @@ public:
lock("DeletingState::lock"), status(QUEUED), stop_deleting(false),
pgid(in.first), old_pg_state(in.second) {}
- /// check whether removal was canceled
- bool check_canceled() {
+ /// transition status to clearing
+ bool start_clearing() {
+ Mutex::Locker l(lock);
+ assert(
+ status == QUEUED ||
+ status == DELETED_DIR);
+ if (stop_deleting) {
+ status = CANCELED;
+ cond.Signal();
+ return false;
+ }
+ status = CLEARING_DIR;
+ return true;
+ } ///< @return false if we should cancel deletion
+
+ /// transition status to CLEARING_WAITING
+ bool pause_clearing() {
Mutex::Locker l(lock);
assert(status == CLEARING_DIR);
if (stop_deleting) {
@@ -169,15 +185,14 @@ public:
cond.Signal();
return false;
}
+ status = CLEARING_WAITING;
return true;
- } ///< @return false if canceled, true if we should continue
+ } ///< @return false if we should cancel deletion
- /// transition status to clearing
- bool start_clearing() {
+ /// transition status to CLEARING_DIR
+ bool resume_clearing() {
Mutex::Locker l(lock);
- assert(
- status == QUEUED ||
- status == DELETED_DIR);
+ assert(status == CLEARING_WAITING);
if (stop_deleting) {
status = CANCELED;
cond.Signal();
@@ -215,11 +230,10 @@ public:
/**
* If we are in DELETING_DIR or CLEARING_DIR, there are in progress
* operations we have to wait for before continuing on. States
- * DELETED_DIR, QUEUED, and CANCELED either check for stop_deleting
- * prior to performing any operations or signify the end of the
- * deleting process. We don't want to wait to leave the QUEUED
- * state, because this might block the caller behind an entire pg
- * removal.
+ * CLEARING_WAITING and QUEUED indicate that the remover will check
+ * stop_deleting before queueing any further operations. CANCELED
+ * indicates that the remover has already halted. DELETED_DIR
+ * indicates that the deletion has been fully queueud.
*/
while (status == DELETING_DIR || status == CLEARING_DIR)
cond.Wait(lock);
diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc
index e5d880f7d24..67f5f1c68b3 100644
--- a/src/rgw/rgw_admin.cc
+++ b/src/rgw/rgw_admin.cc
@@ -236,32 +236,31 @@ enum {
static int get_cmd(const char *cmd, const char *prev_cmd, bool *need_more)
{
*need_more = false;
- if (strcmp(cmd, "bucket") == 0 ||
+ // NOTE: please keep the checks in alphabetical order !!!
+ if (strcmp(cmd, "bilog") == 0 ||
+ strcmp(cmd, "bucket") == 0 ||
strcmp(cmd, "buckets") == 0 ||
- strcmp(cmd, "user") == 0 ||
strcmp(cmd, "caps") == 0 ||
+ strcmp(cmd, "datalog") == 0 ||
strcmp(cmd, "gc") == 0 ||
strcmp(cmd, "key") == 0 ||
strcmp(cmd, "log") == 0 ||
+ strcmp(cmd, "mdlog") == 0 ||
+ strcmp(cmd, "metadata") == 0 ||
strcmp(cmd, "object") == 0 ||
+ strcmp(cmd, "opstate") == 0 ||
strcmp(cmd, "pool") == 0 ||
strcmp(cmd, "pools") == 0 ||
- strcmp(cmd, "subuser") == 0 ||
- strcmp(cmd, "temp") == 0 ||
- strcmp(cmd, "usage") == 0 ||
- strcmp(cmd, "user") == 0 ||
strcmp(cmd, "region") == 0 ||
strcmp(cmd, "regions") == 0 ||
strcmp(cmd, "region-map") == 0 ||
strcmp(cmd, "regionmap") == 0 ||
- strcmp(cmd, "zone") == 0 ||
+ strcmp(cmd, "replicalog") == 0 ||
+ strcmp(cmd, "subuser") == 0 ||
strcmp(cmd, "temp") == 0 ||
- strcmp(cmd, "metadata") == 0 ||
- strcmp(cmd, "mdlog") == 0 ||
- strcmp(cmd, "bilog") == 0 ||
- strcmp(cmd, "datalog") == 0 ||
- strcmp(cmd, "opstate") == 0 ||
- strcmp(cmd, "replicalog") == 0) {
+ strcmp(cmd, "usage") == 0 ||
+ strcmp(cmd, "user") == 0 ||
+ strcmp(cmd, "zone") == 0) {
*need_more = true;
return 0;
}
diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc
index 7b22f44790b..8de5a3d101f 100644
--- a/src/rgw/rgw_bucket.cc
+++ b/src/rgw/rgw_bucket.cc
@@ -93,8 +93,10 @@ int rgw_link_bucket(RGWRados *store, string user_id, rgw_bucket& bucket, time_t
new_bucket.creation_time = creation_time;
::encode(new_bucket, bl);
+ map<string, bufferlist> attrs;
+
if (update_entrypoint) {
- ret = store->get_bucket_entrypoint_info(NULL, bucket_name, ep, &ot, NULL);
+ ret = store->get_bucket_entrypoint_info(NULL, bucket_name, ep, &ot, NULL, &attrs);
if (ret < 0 && ret != -ENOENT) {
ldout(store->ctx(), 0) << "ERROR: store->get_bucket_entrypoint_info() returned " << ret << dendl;
} else if (ret >= 0 && ep.linked && ep.owner != user_id) {
@@ -115,11 +117,11 @@ int rgw_link_bucket(RGWRados *store, string user_id, rgw_bucket& bucket, time_t
}
if (!update_entrypoint)
- return false;
+ return 0;
ep.linked = true;
ep.owner = user_id;
- ret = store->put_bucket_entrypoint_info(bucket_name, ep, false, ot, 0);
+ ret = store->put_bucket_entrypoint_info(bucket_name, ep, false, ot, 0, &attrs);
if (ret < 0)
goto done_err;
@@ -149,11 +151,12 @@ int rgw_unlink_bucket(RGWRados *store, string user_id, const string& bucket_name
}
if (!update_entrypoint)
- return false;
+ return 0;
RGWBucketEntryPoint ep;
RGWObjVersionTracker ot;
- ret = store->get_bucket_entrypoint_info(NULL, bucket_name, ep, &ot, NULL);
+ map<string, bufferlist> attrs;
+ ret = store->get_bucket_entrypoint_info(NULL, bucket_name, ep, &ot, NULL, &attrs);
if (ret == -ENOENT)
return 0;
if (ret < 0)
@@ -168,7 +171,7 @@ int rgw_unlink_bucket(RGWRados *store, string user_id, const string& bucket_name
}
ep.linked = false;
- ret = store->put_bucket_entrypoint_info(bucket_name, ep, false, ot, 0);
+ ret = store->put_bucket_entrypoint_info(bucket_name, ep, false, ot, 0, &attrs);
if (ret < 0)
return ret;
@@ -416,7 +419,6 @@ int RGWBucket::link(RGWBucketAdminOpState& op_state, std::string *err_msg)
std::string display_name = op_state.get_user_display_name();
rgw_bucket bucket = op_state.get_bucket();
- string uid_str(user_info.user_id);
rgw_obj obj(bucket, no_oid);
RGWObjVersionTracker objv_tracker;
@@ -1382,8 +1384,9 @@ public:
RGWBucketEntryPoint be;
time_t mtime;
+ map<string, bufferlist> attrs;
- int ret = store->get_bucket_entrypoint_info(NULL, entry, be, &ot, &mtime);
+ int ret = store->get_bucket_entrypoint_info(NULL, entry, be, &ot, &mtime, &attrs);
if (ret < 0)
return ret;
@@ -1399,16 +1402,17 @@ public:
decode_json_obj(be, obj);
time_t orig_mtime;
+ map<string, bufferlist> attrs;
RGWObjVersionTracker old_ot;
- int ret = store->get_bucket_entrypoint_info(NULL, entry, old_be, &old_ot, &orig_mtime);
+ int ret = store->get_bucket_entrypoint_info(NULL, entry, old_be, &old_ot, &orig_mtime, &attrs);
if (ret < 0 && ret != -ENOENT)
return ret;
objv_tracker.read_version = old_ot.read_version; /* maintain the obj version we just read */
- ret = store->put_bucket_entrypoint_info(entry, be, false, objv_tracker, mtime);
+ ret = store->put_bucket_entrypoint_info(entry, be, false, objv_tracker, mtime, &attrs);
if (ret < 0)
return ret;
@@ -1419,7 +1423,7 @@ public:
ret = rgw_unlink_bucket(store, be.owner, be.bucket.name, false);
}
- return 0;
+ return ret;
}
struct list_keys_info {
@@ -1430,7 +1434,7 @@ public:
int remove(RGWRados *store, string& entry, RGWObjVersionTracker& objv_tracker) {
RGWBucketEntryPoint be;
- int ret = store->get_bucket_entrypoint_info(NULL, entry, be, &objv_tracker, NULL);
+ int ret = store->get_bucket_entrypoint_info(NULL, entry, be, &objv_tracker, NULL, NULL);
if (ret < 0)
return ret;
@@ -1464,7 +1468,7 @@ public:
}
int list_keys_next(void *handle, int max, list<string>& keys, bool *truncated) {
- list_keys_info *info = (list_keys_info *)handle;
+ list_keys_info *info = static_cast<list_keys_info *>(handle);
string no_filter;
@@ -1498,7 +1502,7 @@ public:
}
void list_keys_complete(void *handle) {
- list_keys_info *info = (list_keys_info *)handle;
+ list_keys_info *info = static_cast<list_keys_info *>(handle);
delete info;
}
};
@@ -1611,7 +1615,7 @@ public:
}
int list_keys_next(void *handle, int max, list<string>& keys, bool *truncated) {
- list_keys_info *info = (list_keys_info *)handle;
+ list_keys_info *info = static_cast<list_keys_info *>(handle);
string no_filter;
@@ -1646,7 +1650,7 @@ public:
}
void list_keys_complete(void *handle) {
- list_keys_info *info = (list_keys_info *)handle;
+ list_keys_info *info = static_cast<list_keys_info *>(handle);
delete info;
}
diff --git a/src/rgw/rgw_metadata.cc b/src/rgw/rgw_metadata.cc
index 7be73e6ca0c..ac8c703f5e0 100644
--- a/src/rgw/rgw_metadata.cc
+++ b/src/rgw/rgw_metadata.cc
@@ -104,7 +104,7 @@ void RGWMetadataLog::init_list_entries(int shard_id, utime_t& from_time, utime_t
}
void RGWMetadataLog::complete_list_entries(void *handle) {
- LogListCtx *ctx = (LogListCtx *)handle;
+ LogListCtx *ctx = static_cast<LogListCtx *>(handle);
delete ctx;
}
@@ -112,7 +112,7 @@ int RGWMetadataLog::list_entries(void *handle,
int max_entries,
list<cls_log_entry>& entries,
bool *truncated) {
- LogListCtx *ctx = (LogListCtx *)handle;
+ LogListCtx *ctx = static_cast<LogListCtx *>(handle);
if (!max_entries) {
*truncated = false;
@@ -210,7 +210,7 @@ public:
return 0;
}
virtual int list_keys_next(void *handle, int max, list<string>& keys, bool *truncated) {
- iter_data *data = (iter_data *)handle;
+ iter_data *data = static_cast<iter_data *>(handle);
for (int i = 0; i < max && data->iter != data->sections.end(); ++i, ++(data->iter)) {
keys.push_back(*data->iter);
}
@@ -220,7 +220,7 @@ public:
return 0;
}
virtual void list_keys_complete(void *handle) {
- iter_data *data = (iter_data *)handle;
+ iter_data *data = static_cast<iter_data *>(handle);
delete data;
}
@@ -451,7 +451,7 @@ int RGWMetadataManager::list_keys_init(string& section, void **handle)
int RGWMetadataManager::list_keys_next(void *handle, int max, list<string>& keys, bool *truncated)
{
- list_keys_handle *h = (list_keys_handle *)handle;
+ list_keys_handle *h = static_cast<list_keys_handle *>(handle);
RGWMetadataHandler *handler = h->handler;
@@ -461,7 +461,7 @@ int RGWMetadataManager::list_keys_next(void *handle, int max, list<string>& keys
void RGWMetadataManager::list_keys_complete(void *handle)
{
- list_keys_handle *h = (list_keys_handle *)handle;
+ list_keys_handle *h = static_cast<list_keys_handle *>(handle);
RGWMetadataHandler *handler = h->handler;
diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc
index 97ae5fc6f0c..7760a2f5c52 100644
--- a/src/rgw/rgw_op.cc
+++ b/src/rgw/rgw_op.cc
@@ -180,11 +180,10 @@ static int get_bucket_policy_from_attr(CephContext *cct, RGWRados *store, void *
RGWBucketInfo& bucket_info, map<string, bufferlist>& bucket_attrs,
RGWAccessControlPolicy *policy, rgw_obj& obj)
{
- int ret;
map<string, bufferlist>::iterator aiter = bucket_attrs.find(RGW_ATTR_ACL);
if (aiter != bucket_attrs.end()) {
- ret = decode_policy(cct, aiter->second, policy);
+ int ret = decode_policy(cct, aiter->second, policy);
if (ret < 0)
return ret;
} else {
diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h
index 0c338dea8a9..5da2e4f472c 100644
--- a/src/rgw/rgw_op.h
+++ b/src/rgw/rgw_op.h
@@ -50,7 +50,7 @@ public:
virtual void execute() = 0;
virtual void send_response() {}
virtual void complete() { send_response(); }
- virtual const char *name() = 0;
+ virtual const string name() = 0;
virtual uint32_t op_mask() { return 0; }
};
@@ -117,7 +117,7 @@ public:
virtual int get_params() = 0;
virtual int send_response_data(bufferlist& bl, off_t ofs, off_t len) = 0;
- virtual const char *name() { return "get_obj"; }
+ virtual const string name() { return "get_obj"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
};
@@ -147,7 +147,7 @@ public:
virtual bool should_get_stats() { return false; }
- virtual const char *name() { return "list_buckets"; }
+ virtual const string name() { return "list_buckets"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
};
@@ -172,7 +172,7 @@ public:
void execute();
virtual void send_response() = 0;
- virtual const char *name() { return "stat_account"; }
+ virtual const string name() { return "stat_account"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
};
@@ -204,7 +204,7 @@ public:
virtual int get_params() = 0;
virtual void send_response() = 0;
- virtual const char *name() { return "list_bucket"; }
+ virtual const string name() { return "list_bucket"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
};
@@ -215,7 +215,7 @@ public:
void execute() {}
virtual void send_response() = 0;
- virtual const char *name() { return "get_bucket_logging"; }
+ virtual const string name() { return "get_bucket_logging"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
};
@@ -232,7 +232,7 @@ public:
void execute();
virtual void send_response() = 0;
- virtual const char *name() { return "stat_bucket"; }
+ virtual const string name() { return "stat_bucket"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
};
@@ -258,7 +258,7 @@ public:
}
virtual int get_params() { return 0; }
virtual void send_response() = 0;
- virtual const char *name() { return "create_bucket"; }
+ virtual const string name() { return "create_bucket"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_WRITE; }
};
@@ -275,7 +275,7 @@ public:
void execute();
virtual void send_response() = 0;
- virtual const char *name() { return "delete_bucket"; }
+ virtual const string name() { return "delete_bucket"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_DELETE; }
};
@@ -319,7 +319,7 @@ public:
virtual int get_params() = 0;
virtual int get_data(bufferlist& bl) = 0;
virtual void send_response() = 0;
- virtual const char *name() { return "put_obj"; }
+ virtual const string name() { return "put_obj"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_WRITE; }
};
@@ -361,7 +361,7 @@ public:
virtual int get_params() = 0;
virtual int get_data(bufferlist& bl) = 0;
virtual void send_response() = 0;
- virtual const char *name() { return "post_obj"; }
+ virtual const string name() { return "post_obj"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_WRITE; }
};
@@ -389,7 +389,7 @@ public:
virtual int get_params() = 0;
virtual void send_response() = 0;
- virtual const char *name() { return "put_obj_metadata"; }
+ virtual const string name() { return "put_obj_metadata"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_WRITE; }
};
@@ -404,7 +404,7 @@ public:
void execute();
virtual void send_response() = 0;
- virtual const char *name() { return "delete_obj"; }
+ virtual const string name() { return "delete_obj"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_DELETE; }
};
@@ -477,7 +477,7 @@ public:
virtual int get_params() = 0;
virtual void send_partial_response(off_t ofs) {}
virtual void send_response() = 0;
- virtual const char *name() { return "copy_obj"; }
+ virtual const string name() { return "copy_obj"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_WRITE; }
};
@@ -493,7 +493,7 @@ public:
void execute();
virtual void send_response() = 0;
- virtual const char *name() { return "get_acls"; }
+ virtual const string name() { return "get_acls"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
};
@@ -519,7 +519,7 @@ public:
virtual int get_policy_from_state(RGWRados *store, struct req_state *s, stringstream& ss) { return 0; }
virtual int get_params() = 0;
virtual void send_response() = 0;
- virtual const char *name() { return "put_acls"; }
+ virtual const string name() { return "put_acls"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_WRITE; }
};
@@ -535,7 +535,7 @@ public:
void execute();
virtual void send_response() = 0;
- virtual const char *name() { return "get_cors"; }
+ virtual const string name() { return "get_cors"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
};
@@ -560,7 +560,7 @@ public:
virtual int get_params() = 0;
virtual void send_response() = 0;
- virtual const char *name() { return "put_cors"; }
+ virtual const string name() { return "put_cors"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_WRITE; }
};
@@ -575,7 +575,7 @@ public:
void execute();
virtual void send_response() = 0;
- virtual const char *name() { return "delete_cors"; }
+ virtual const string name() { return "delete_cors"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_WRITE; }
};
@@ -595,7 +595,7 @@ public:
void execute();
void get_response_params(string& allowed_hdrs, string& exp_hdrs, unsigned *max_age);
virtual void send_response() = 0;
- virtual const char *name() { return "options_cors"; }
+ virtual const string name() { return "options_cors"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
};
@@ -619,7 +619,7 @@ public:
virtual int get_params() = 0;
virtual void send_response() = 0;
- virtual const char *name() { return "init_multipart"; }
+ virtual const string name() { return "init_multipart"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_WRITE; }
};
@@ -648,7 +648,7 @@ public:
virtual int get_params() = 0;
virtual void send_response() = 0;
- virtual const char *name() { return "complete_multipart"; }
+ virtual const string name() { return "complete_multipart"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_WRITE; }
};
@@ -663,7 +663,7 @@ public:
void execute();
virtual void send_response() = 0;
- virtual const char *name() { return "abort_multipart"; }
+ virtual const string name() { return "abort_multipart"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_DELETE; }
};
@@ -692,7 +692,7 @@ public:
virtual int get_params() = 0;
virtual void send_response() = 0;
- virtual const char *name() { return "list_multipart"; }
+ virtual const string name() { return "list_multipart"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
};
@@ -795,7 +795,7 @@ public:
virtual int get_params() = 0;
virtual void send_response() = 0;
- virtual const char *name() { return "list_bucket_multiparts"; }
+ virtual const string name() { return "list_bucket_multiparts"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
};
@@ -828,7 +828,7 @@ public:
virtual void begin_response() = 0;
virtual void send_partial_response(pair<string,int>& result) = 0;
virtual void end_response() = 0;
- virtual const char *name() { return "multi_object_delete"; }
+ virtual const string name() { return "multi_object_delete"; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_DELETE; }
};
diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc
index 3c8d9757ca6..8af03b03a8f 100644
--- a/src/rgw/rgw_rados.cc
+++ b/src/rgw/rgw_rados.cc
@@ -4592,11 +4592,12 @@ int RGWRados::get_bucket_instance_from_oid(void *ctx, string& oid, RGWBucketInfo
int RGWRados::get_bucket_entrypoint_info(void *ctx, const string& bucket_name,
RGWBucketEntryPoint& entry_point,
RGWObjVersionTracker *objv_tracker,
- time_t *pmtime)
+ time_t *pmtime,
+ map<string, bufferlist> *pattrs)
{
bufferlist bl;
- int ret = rgw_get_system_obj(this, ctx, zone.domain_root, bucket_name, bl, objv_tracker, pmtime, NULL);
+ int ret = rgw_get_system_obj(this, ctx, zone.domain_root, bucket_name, bl, objv_tracker, pmtime, pattrs);
if (ret < 0) {
return ret;
}
@@ -4619,7 +4620,7 @@ int RGWRados::get_bucket_info(void *ctx, string& bucket_name, RGWBucketInfo& inf
RGWBucketEntryPoint entry_point;
time_t ep_mtime;
RGWObjVersionTracker ot;
- int ret = get_bucket_entrypoint_info(ctx, bucket_name, entry_point, &ot, &ep_mtime);
+ int ret = get_bucket_entrypoint_info(ctx, bucket_name, entry_point, &ot, &ep_mtime, pattrs);
if (ret < 0) {
info.bucket.name = bucket_name; /* only init this field */
return ret;
@@ -4632,6 +4633,13 @@ int RGWRados::get_bucket_info(void *ctx, string& bucket_name, RGWBucketInfo& inf
return 0;
}
+ /* data is in the bucket instance object, we need to get attributes from there, clear everything
+ * that we got
+ */
+ if (pattrs) {
+ pattrs->clear();
+ }
+
ldout(cct, 20) << "rgw_get_bucket_info: bucket instance: " << entry_point.bucket << dendl;
if (pattrs)
@@ -4652,11 +4660,12 @@ int RGWRados::get_bucket_info(void *ctx, string& bucket_name, RGWBucketInfo& inf
}
int RGWRados::put_bucket_entrypoint_info(const string& bucket_name, RGWBucketEntryPoint& entry_point,
- bool exclusive, RGWObjVersionTracker& objv_tracker, time_t mtime)
+ bool exclusive, RGWObjVersionTracker& objv_tracker, time_t mtime,
+ map<string, bufferlist> *pattrs)
{
bufferlist epbl;
::encode(entry_point, epbl);
- return rgw_bucket_store_info(this, bucket_name, epbl, exclusive, NULL, &objv_tracker, mtime);
+ return rgw_bucket_store_info(this, bucket_name, epbl, exclusive, pattrs, &objv_tracker, mtime);
}
int RGWRados::put_bucket_instance_info(RGWBucketInfo& info, bool exclusive,
@@ -4701,7 +4710,7 @@ int RGWRados::put_linked_bucket_info(RGWBucketInfo& info, bool exclusive, time_t
*pep_objv = ot.write_version;
}
}
- ret = put_bucket_entrypoint_info(info.bucket.name, entry_point, exclusive, ot, mtime);
+ ret = put_bucket_entrypoint_info(info.bucket.name, entry_point, exclusive, ot, mtime, NULL);
if (ret < 0)
return ret;
@@ -5673,7 +5682,7 @@ int RGWStateLog::list_entries(void *handle, int max_entries,
list<cls_statelog_entry>& entries,
bool *done)
{
- list_state *state = (list_state *)handle;
+ list_state *state = static_cast<list_state *>(handle);
librados::IoCtx ioctx;
int r = open_ioctx(ioctx);
@@ -5721,7 +5730,7 @@ int RGWStateLog::list_entries(void *handle, int max_entries,
void RGWStateLog::finish_list_entries(void *handle)
{
- list_state *state = (list_state *)handle;
+ list_state *state = static_cast<list_state *>(handle);
delete state;
}
diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h
index 0ef71666244..bcc40900299 100644
--- a/src/rgw/rgw_rados.h
+++ b/src/rgw/rgw_rados.h
@@ -1288,9 +1288,11 @@ public:
void get_bucket_instance_entry(rgw_bucket& bucket, string& entry);
void get_bucket_meta_oid(rgw_bucket& bucket, string& oid);
- int put_bucket_entrypoint_info(const string& bucket_name, RGWBucketEntryPoint& entry_point, bool exclusive, RGWObjVersionTracker& objv_tracker, time_t mtime);
+ int put_bucket_entrypoint_info(const string& bucket_name, RGWBucketEntryPoint& entry_point, bool exclusive, RGWObjVersionTracker& objv_tracker, time_t mtime,
+ map<string, bufferlist> *pattrs);
int put_bucket_instance_info(RGWBucketInfo& info, bool exclusive, time_t mtime, map<string, bufferlist> *pattrs);
- int get_bucket_entrypoint_info(void *ctx, const string& bucket_name, RGWBucketEntryPoint& entry_point, RGWObjVersionTracker *objv_tracker, time_t *pmtime);
+ int get_bucket_entrypoint_info(void *ctx, const string& bucket_name, RGWBucketEntryPoint& entry_point, RGWObjVersionTracker *objv_tracker, time_t *pmtime,
+ map<string, bufferlist> *pattrs);
int get_bucket_instance_info(void *ctx, const string& meta_key, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs);
int get_bucket_instance_info(void *ctx, rgw_bucket& bucket, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs);
int get_bucket_instance_from_oid(void *ctx, string& oid, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs);
diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc
index 623bb0b5e16..0f9e61d1740 100644
--- a/src/rgw/rgw_rest.cc
+++ b/src/rgw/rgw_rest.cc
@@ -835,8 +835,10 @@ int rgw_rest_read_all_input(struct req_state *s, char **pdata, int *plen, int ma
return -ENOMEM;
}
int ret = s->cio->read(data, cl, &len);
- if (ret < 0)
+ if (ret < 0) {
+ free(data);
return ret;
+ }
data[len] = '\0';
} else if (!s->length) {
const char *encoding = s->info.env->get("HTTP_TRANSFER_ENCODING");
diff --git a/src/rgw/rgw_rest_bucket.cc b/src/rgw/rgw_rest_bucket.cc
index 80b5b876916..e7068b43c49 100644
--- a/src/rgw/rgw_rest_bucket.cc
+++ b/src/rgw/rgw_rest_bucket.cc
@@ -17,7 +17,7 @@ public:
void execute();
- virtual const char *name() { return "get_bucket_info"; }
+ virtual const string name() { return "get_bucket_info"; }
};
void RGWOp_Bucket_Info::execute()
@@ -52,7 +52,7 @@ public:
void execute();
- virtual const char *name() { return "get_policy"; }
+ virtual const string name() { return "get_policy"; }
};
void RGWOp_Get_Policy::execute()
@@ -82,7 +82,7 @@ public:
void execute();
- virtual const char *name() { return "check_bucket_index"; }
+ virtual const string name() { return "check_bucket_index"; }
};
void RGWOp_Check_Bucket_Index::execute()
@@ -116,7 +116,7 @@ public:
void execute();
- virtual const char *name() { return "link_bucket"; }
+ virtual const string name() { return "link_bucket"; }
};
void RGWOp_Bucket_Link::execute()
@@ -146,7 +146,7 @@ public:
void execute();
- virtual const char *name() { return "unlink_bucket"; }
+ virtual const string name() { return "unlink_bucket"; }
};
void RGWOp_Bucket_Unlink::execute()
@@ -176,7 +176,7 @@ public:
void execute();
- virtual const char *name() { return "remove_bucket"; }
+ virtual const string name() { return "remove_bucket"; }
};
void RGWOp_Bucket_Remove::execute()
@@ -206,7 +206,7 @@ public:
void execute();
- virtual const char *name() { return "remove_object"; }
+ virtual const string name() { return "remove_object"; }
};
void RGWOp_Object_Remove::execute()
diff --git a/src/rgw/rgw_rest_config.h b/src/rgw/rgw_rest_config.h
index cb1712ac3d7..2e0408afb3d 100644
--- a/src/rgw/rgw_rest_config.h
+++ b/src/rgw/rgw_rest_config.h
@@ -25,7 +25,7 @@ public:
}
void execute();
virtual void send_response();
- virtual const char *name() {
+ virtual const string name() {
return "get_region_map";
}
};
diff --git a/src/rgw/rgw_rest_log.h b/src/rgw/rgw_rest_log.h
index 38c6b5fb4ab..2d60e289b84 100644
--- a/src/rgw/rgw_rest_log.h
+++ b/src/rgw/rgw_rest_log.h
@@ -32,7 +32,7 @@ public:
virtual void send_response(list<rgw_bi_log_entry>& entries, string& marker);
virtual void send_response_end();
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "list_bucket_index_log";
}
};
@@ -53,7 +53,7 @@ public:
}
virtual void send_response();
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "bucket_index_log_info";
}
};
@@ -67,7 +67,7 @@ public:
return caps.check_cap("bilog", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "trim_bucket_index_log";
}
};
@@ -87,7 +87,7 @@ public:
}
void execute();
virtual void send_response();
- virtual const char *name() {
+ virtual const string name() {
return "list_metadata_log";
}
};
@@ -107,7 +107,7 @@ public:
}
void execute();
virtual void send_response();
- virtual const char *name() {
+ virtual const string name() {
return "get_metadata_log_info";
}
};
@@ -126,7 +126,7 @@ public:
}
void execute();
virtual void send_response();
- virtual const char *name() {
+ virtual const string name() {
return "get_metadata_log_shard_info";
}
};
@@ -140,7 +140,7 @@ public:
return caps.check_cap("mdlog", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "lock_mdlog_object";
}
};
@@ -154,7 +154,7 @@ public:
return caps.check_cap("mdlog", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "unlock_mdlog_object";
}
};
@@ -168,7 +168,7 @@ public:
return caps.check_cap("mdlog", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "trim_metadata_log";
}
};
@@ -188,7 +188,7 @@ public:
}
void execute();
virtual void send_response();
- virtual const char *name() {
+ virtual const string name() {
return "list_data_changes_log";
}
};
@@ -208,7 +208,7 @@ public:
}
void execute();
virtual void send_response();
- virtual const char *name() {
+ virtual const string name() {
return "get_data_changes_log_info";
}
};
@@ -227,7 +227,7 @@ public:
}
void execute();
virtual void send_response();
- virtual const char *name() {
+ virtual const string name() {
return "get_data_changes_log_shard_info";
}
};
@@ -241,7 +241,7 @@ public:
return caps.check_cap("datalog", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "lock_datalog_object";
}
};
@@ -255,7 +255,7 @@ public:
return caps.check_cap("datalog", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "unlock_datalog_object";
}
};
@@ -269,7 +269,7 @@ public:
return caps.check_cap("datalog", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "trim_data_changes_log";
}
};
diff --git a/src/rgw/rgw_rest_metadata.cc b/src/rgw/rgw_rest_metadata.cc
index 69f8a5ccbc4..35ec0ab9b04 100644
--- a/src/rgw/rgw_rest_metadata.cc
+++ b/src/rgw/rgw_rest_metadata.cc
@@ -23,7 +23,7 @@
#define dout_subsys ceph_subsys_rgw
-const char *RGWOp_Metadata_Get::name() {
+const string RGWOp_Metadata_Get::name() {
return "get_metadata";
}
@@ -62,7 +62,7 @@ void RGWOp_Metadata_Get::execute() {
http_ret = 0;
}
-const char *RGWOp_Metadata_List::name() {
+const string RGWOp_Metadata_List::name() {
return "list_metadata";
}
diff --git a/src/rgw/rgw_rest_metadata.h b/src/rgw/rgw_rest_metadata.h
index 85993d08d58..59d7c5f7045 100644
--- a/src/rgw/rgw_rest_metadata.h
+++ b/src/rgw/rgw_rest_metadata.h
@@ -23,7 +23,7 @@ public:
return caps.check_cap("metadata", RGW_CAP_READ);
}
void execute();
- virtual const char *name();
+ virtual const string name();
};
class RGWOp_Metadata_Get : public RGWRESTOp {
@@ -35,7 +35,7 @@ public:
return caps.check_cap("metadata", RGW_CAP_READ);
}
void execute();
- virtual const char *name();
+ virtual const string name();
};
class RGWOp_Metadata_Put : public RGWRESTOp {
@@ -48,7 +48,7 @@ public:
return caps.check_cap("metadata", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() { return "set_metadata"; }
+ virtual const string name() { return "set_metadata"; }
};
class RGWOp_Metadata_Delete : public RGWRESTOp {
@@ -60,7 +60,7 @@ public:
return caps.check_cap("metadata", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() { return "remove_metadata"; }
+ virtual const string name() { return "remove_metadata"; }
};
class RGWOp_Metadata_Lock : public RGWRESTOp {
@@ -72,7 +72,7 @@ public:
return caps.check_cap("metadata", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "lock_metadata_object";
}
};
@@ -86,7 +86,7 @@ public:
return caps.check_cap("metadata", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "unlock_metadata_object";
}
};
diff --git a/src/rgw/rgw_rest_opstate.h b/src/rgw/rgw_rest_opstate.h
index 8f6a9675a68..de13dde6966 100644
--- a/src/rgw/rgw_rest_opstate.h
+++ b/src/rgw/rgw_rest_opstate.h
@@ -30,7 +30,7 @@ public:
virtual void send_response();
virtual void send_response(list<cls_statelog_entry> entries);
virtual void send_response_end();
- virtual const char *name() {
+ virtual const string name() {
return "opstate_list";
}
};
@@ -44,7 +44,7 @@ public:
return caps.check_cap("opstate", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "set_opstate";
}
};
@@ -58,7 +58,7 @@ public:
return caps.check_cap("opstate", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "renew_opstate";
}
};
@@ -72,7 +72,7 @@ public:
return caps.check_cap("opstate", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "delete_opstate";
}
};
diff --git a/src/rgw/rgw_rest_replica_log.h b/src/rgw/rgw_rest_replica_log.h
index 91e3d614062..c879150cc07 100644
--- a/src/rgw/rgw_rest_replica_log.h
+++ b/src/rgw/rgw_rest_replica_log.h
@@ -32,11 +32,11 @@ public:
}
void execute();
virtual void send_response();
- virtual const char *name() {
+ virtual const string name() {
string s = "replica";
s.append(obj_type);
s.append("_getbounds");
- return s.c_str();
+ return s;
}
};
@@ -52,11 +52,11 @@ public:
return caps.check_cap(obj_type.c_str(), RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
string s = "replica";
s.append(obj_type);
s.append("_updatebounds");
- return s.c_str();
+ return s;
}
};
@@ -72,11 +72,11 @@ public:
return caps.check_cap(obj_type.c_str(), RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
string s = "replica";
s.append(obj_type);
s.append("_deletebound");
- return s.c_str();
+ return s;
}
};
@@ -94,7 +94,7 @@ public:
}
void execute();
virtual void send_response();
- virtual const char *name() {
+ virtual const string name() {
return "replicabilog_getbounds";
}
};
@@ -108,7 +108,7 @@ public:
return caps.check_cap("bilog", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "replicabilog_updatebounds";
}
};
@@ -122,7 +122,7 @@ public:
return caps.check_cap("bilog", RGW_CAP_WRITE);
}
void execute();
- virtual const char *name() {
+ virtual const string name() {
return "replicabilog_deletebound";
}
};
diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc
index 199ccc485eb..e131eeee28d 100644
--- a/src/rgw/rgw_rest_s3.cc
+++ b/src/rgw/rgw_rest_s3.cc
@@ -409,12 +409,13 @@ int RGWCreateBucket_ObjStore_S3::get_params()
bool success = parser.parse(data, len, 1);
ldout(s->cct, 20) << "create bucket input data=" << data << dendl;
- free(data);
if (!success) {
ldout(s->cct, 0) << "failed to parse input: " << data << dendl;
+ free(data);
return -EINVAL;
}
+ free(data);
if (!parser.get_location_constraint(location_constraint)) {
ldout(s->cct, 0) << "provided input did not specify location constraint correctly" << dendl;
diff --git a/src/rgw/rgw_rest_usage.cc b/src/rgw/rgw_rest_usage.cc
index 769e167019a..1124d2b298b 100644
--- a/src/rgw/rgw_rest_usage.cc
+++ b/src/rgw/rgw_rest_usage.cc
@@ -16,7 +16,7 @@ public:
}
void execute();
- virtual const char *name() { return "get_usage"; }
+ virtual const string name() { return "get_usage"; }
};
void RGWOp_Usage_Get::execute() {
@@ -58,7 +58,7 @@ public:
}
void execute();
- virtual const char *name() { return "trim_usage"; }
+ virtual const string name() { return "trim_usage"; }
};
void RGWOp_Usage_Delete::execute() {
diff --git a/src/rgw/rgw_rest_user.cc b/src/rgw/rgw_rest_user.cc
index ac0d794846c..3d08e403229 100644
--- a/src/rgw/rgw_rest_user.cc
+++ b/src/rgw/rgw_rest_user.cc
@@ -17,7 +17,7 @@ public:
void execute();
- virtual const char *name() { return "get_user_info"; }
+ virtual const string name() { return "get_user_info"; }
};
void RGWOp_User_Info::execute()
@@ -44,7 +44,7 @@ public:
void execute();
- virtual const char *name() { return "create_user"; }
+ virtual const string name() { return "create_user"; }
};
void RGWOp_User_Create::execute()
@@ -138,7 +138,7 @@ public:
void execute();
- virtual const char *name() { return "modify_user"; }
+ virtual const string name() { return "modify_user"; }
};
void RGWOp_User_Modify::execute()
@@ -232,7 +232,7 @@ public:
void execute();
- virtual const char *name() { return "remove_user"; }
+ virtual const string name() { return "remove_user"; }
};
void RGWOp_User_Remove::execute()
@@ -265,7 +265,7 @@ public:
void execute();
- virtual const char *name() { return "create_subuser"; }
+ virtual const string name() { return "create_subuser"; }
};
void RGWOp_Subuser_Create::execute()
@@ -334,7 +334,7 @@ public:
void execute();
- virtual const char *name() { return "modify_subuser"; }
+ virtual const string name() { return "modify_subuser"; }
};
void RGWOp_Subuser_Modify::execute()
@@ -399,7 +399,7 @@ public:
void execute();
- virtual const char *name() { return "remove_subuser"; }
+ virtual const string name() { return "remove_subuser"; }
};
void RGWOp_Subuser_Remove::execute()
@@ -438,7 +438,7 @@ public:
void execute();
- virtual const char *name() { return "create_access_key"; }
+ virtual const string name() { return "create_access_key"; }
};
void RGWOp_Key_Create::execute()
@@ -500,7 +500,7 @@ public:
void execute();
- virtual const char *name() { return "remove_access_key"; }
+ virtual const string name() { return "remove_access_key"; }
};
void RGWOp_Key_Remove::execute()
@@ -552,7 +552,7 @@ public:
void execute();
- virtual const char *name() { return "add_user_caps"; }
+ virtual const string name() { return "add_user_caps"; }
};
void RGWOp_Caps_Add::execute()
@@ -586,7 +586,7 @@ public:
void execute();
- virtual const char *name() { return "remove_user_caps"; }
+ virtual const string name() { return "remove_user_caps"; }
};
void RGWOp_Caps_Remove::execute()
diff --git a/src/rgw/rgw_swift_auth.h b/src/rgw/rgw_swift_auth.h
index 8a58b476496..670a339210d 100644
--- a/src/rgw/rgw_swift_auth.h
+++ b/src/rgw/rgw_swift_auth.h
@@ -15,7 +15,7 @@ public:
int verify_permission() { return 0; }
void execute();
- virtual const char *name() { return "swift_auth_get"; }
+ virtual const string name() { return "swift_auth_get"; }
};
class RGWHandler_SWIFT_Auth : public RGWHandler {
diff --git a/src/test/cls_version/test_cls_version.cc b/src/test/cls_version/test_cls_version.cc
index 6392424644a..caa0a36cd74 100644
--- a/src/test/cls_version/test_cls_version.cc
+++ b/src/test/cls_version/test_cls_version.cc
@@ -76,7 +76,7 @@ TEST(cls_rgw, test_version_inc_read)
ASSERT_EQ(ver2.ver, ver3.ver);
ASSERT_EQ(1, (long long)ver2.compare(&ver3));
- delete op;
+ delete rop;
}