summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/rados/configuration/mon-osd-interaction.rst20
-rw-r--r--src/dupstore.cc8
-rw-r--r--src/librados/AioCompletionImpl.h2
-rw-r--r--src/mds/Server.cc19
-rw-r--r--src/mon/Monitor.cc1
-rw-r--r--src/mon/Monitor.h1
-rw-r--r--src/mon/QuorumService.h1
-rw-r--r--src/rbd.cc2
-rw-r--r--src/rgw/rgw_user.cc5
-rw-r--r--src/scratchtool.c37
-rw-r--r--src/test/filestore/test_idempotent_sequence.cc8
-rw-r--r--src/test/kv_store_bench.cc8
-rw-r--r--src/test/librbd/test_librbd.cc5
-rw-r--r--src/test/test_cors.cc10
-rw-r--r--src/test/test_filejournal.cc2
-rw-r--r--src/tools/ceph-filestore-dump.cc4
-rw-r--r--src/tools/ceph.cc6
17 files changed, 97 insertions, 42 deletions
diff --git a/doc/rados/configuration/mon-osd-interaction.rst b/doc/rados/configuration/mon-osd-interaction.rst
index fd54a671c99..a6bfa632872 100644
--- a/doc/rados/configuration/mon-osd-interaction.rst
+++ b/doc/rados/configuration/mon-osd-interaction.rst
@@ -63,15 +63,17 @@ Ceph configuration file, or by setting the value at runtime.
OSDs Report Down OSDs
=====================
-By default, an OSD must report to the monitors that another OSD is ``down``
-three times before the monitors acknowledge that the reported OSD is ``down``.
-You can change the minimum number of ``osd down`` reports by adding an ``osd min
-down reports`` setting under the ``[osd]`` section of your Ceph configuration
-file, or by setting the value at runtime. By default, only one OSD is required
-to report another OSD down. You can change the number of OSDs required to report
-a monitor down by adding an ``mon osd min down reporters`` setting under the
-``[mon]`` section of your Ceph configuration file, or by setting the value at
-runtime.
+By default, an OSD must report to the monitors that another OSD is
+``down`` three times before the monitors acknowledge that the reported
+OSD is ``down``. You can change the minimum number of ``osd down``
+reports by adding an ``mon osd min down reports`` setting (``osd min
+down reports`` prior to v0.62) under the ``[mon]`` section of your
+Ceph configuration file, or by setting the value at runtime. By
+default, only one OSD is required to report another OSD down. You can
+change the number of OSDs required to report a monitor down by adding
+an ``mon osd min down reporters`` setting (``osd min down reporters''
+prior to v0.62) under the ``[mon]`` section of your Ceph configuration
+file, or by setting the value at runtime.
.. ditaa:: +---------+ +---------+
diff --git a/src/dupstore.cc b/src/dupstore.cc
index b0ba26109e9..e17eb2201a7 100644
--- a/src/dupstore.cc
+++ b/src/dupstore.cc
@@ -31,7 +31,13 @@ int dupstore(ObjectStore* src, ObjectStore* dst)
// collections
vector<coll_t> collections;
- src->list_collections(collections);
+
+ int ret = src->list_collections(collections);
+ if (ret < 0) {
+ cerr << "Error " << ret << " while listing collections" << std::endl;
+ return 1;
+ }
+
int num = collections.size();
cout << num << " collections" << std::endl;
int i = 1;
diff --git a/src/librados/AioCompletionImpl.h b/src/librados/AioCompletionImpl.h
index b3e1e8a16e2..34462d22063 100644
--- a/src/librados/AioCompletionImpl.h
+++ b/src/librados/AioCompletionImpl.h
@@ -212,9 +212,11 @@ struct C_AioCompleteAndSafe : public Context {
}
void finish(int r) {
+ c->lock.Lock();
c->rval = r;
c->ack = true;
c->safe = true;
+ c->lock.Unlock();
rados_callback_t cb_complete = c->callback_complete;
void *cb_arg = c->callback_arg;
if (cb_complete)
diff --git a/src/mds/Server.cc b/src/mds/Server.cc
index d97047d6d49..b526b5e036a 100644
--- a/src/mds/Server.cc
+++ b/src/mds/Server.cc
@@ -6210,9 +6210,12 @@ void Server::_rename_prepare(MDRequest *mdr,
// guarantee stray dir is processed first during journal replay. unlink the old inode,
// then link the source inode to destdn
- if (destdnl->is_primary() && straydn->is_auth()) {
- metablob->add_dir_context(straydn->get_dir());
- metablob->add_dir(straydn->get_dir(), true);
+ if (destdnl->is_primary()) {
+ assert(straydn);
+ if (straydn->is_auth()) {
+ metablob->add_dir_context(straydn->get_dir());
+ metablob->add_dir(straydn->get_dir(), true);
+ }
}
// sub off target
@@ -6943,7 +6946,7 @@ void Server::do_rename_rollback(bufferlist &rbl, int master, MDRequest *mdr)
bool force_journal_dest = false;
if (in && in->is_dir() && srcdn->authority().first != whoami)
force_journal_src = _need_force_journal(in, false);
- if (target && target->is_dir())
+ if (in && target && target->is_dir())
force_journal_dest = _need_force_journal(in, true);
version_t srcdnpv = 0;
@@ -7091,15 +7094,19 @@ void Server::_rename_rollback_finish(Mutation *mut, MDRequest *mdr, CDentry *src
if (srcdn) {
CInode *in = srcdn->get_linkage()->get_inode();
// update subtree map?
- if (in && in->is_dir())
+ if (in && in->is_dir()) {
+ assert(destdn);
mdcache->adjust_subtree_after_rename(in, destdn->get_dir(), true);
+ }
}
if (destdn) {
CInode *oldin = destdn->get_linkage()->get_inode();
// update subtree map?
- if (oldin && oldin->is_dir())
+ if (oldin && oldin->is_dir()) {
+ assert(straydn);
mdcache->adjust_subtree_after_rename(oldin, straydn->get_dir(), true);
+ }
}
if (mds->is_resolve()) {
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc
index 284f50685c3..7325bfade6b 100644
--- a/src/mon/Monitor.cc
+++ b/src/mon/Monitor.cc
@@ -150,6 +150,7 @@ Monitor::Monitor(CephContext* cct_, string nm, MonitorDBStore *s,
sync_provider(),
timecheck_round(0),
+ timecheck_acks(0),
timecheck_event(NULL),
probe_timeout_event(NULL),
diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h
index 57da2aba539..1443525e9e6 100644
--- a/src/mon/Monitor.h
+++ b/src/mon/Monitor.h
@@ -548,6 +548,7 @@ private:
version(0),
timeout(NULL),
sync_state(STATE_NONE),
+ crc(0),
crc_available(false),
attempts(0)
{ }
diff --git a/src/mon/QuorumService.h b/src/mon/QuorumService.h
index 7506421caf4..16eb8b0542a 100644
--- a/src/mon/QuorumService.h
+++ b/src/mon/QuorumService.h
@@ -29,7 +29,6 @@
class QuorumService : public RefCountedObject
{
- uint32_t flags;
Context *tick_event;
double tick_period;
diff --git a/src/rbd.cc b/src/rbd.cc
index 3e586bd4dcb..5e7389162f2 100644
--- a/src/rbd.cc
+++ b/src/rbd.cc
@@ -1294,7 +1294,7 @@ static int do_import(librbd::RBD &rbd, librados::IoCtx& io_ctx,
bool from_stdin = !strcmp(path, "-");
if (from_stdin) {
fd = 0;
- size = 1 << *order;
+ size = 1ULL << *order;
} else {
fd = open(path, O_RDONLY);
diff --git a/src/rgw/rgw_user.cc b/src/rgw/rgw_user.cc
index b160ff87444..781fce46eda 100644
--- a/src/rgw/rgw_user.cc
+++ b/src/rgw/rgw_user.cc
@@ -992,7 +992,10 @@ int RGWAccessKeyPool::remove(RGWUserAdminOpState& op_state, std::string *err_msg
RGWSubUserPool::RGWSubUserPool(RGWUser *usr)
{
subusers_allowed = (usr != NULL);
- store = usr->get_store();
+ if (usr)
+ store = usr->get_store();
+ else
+ store = NULL;
user = usr;
subuser_map = NULL;
}
diff --git a/src/scratchtool.c b/src/scratchtool.c
index 6934e0ccd6d..22cf2bdf531 100644
--- a/src/scratchtool.c
+++ b/src/scratchtool.c
@@ -105,6 +105,7 @@ static int testrados(void)
{
char tmp[32];
int i, r;
+ int ret = 1; //set 1 as error case
rados_t cl;
if (rados_create(&cl, NULL) < 0) {
@@ -114,7 +115,7 @@ static int testrados(void)
if (rados_conf_read_file(cl, NULL)) {
printf("error reading configuration file\n");
- return 1;
+ goto out_err;
}
// Try to set a configuration option that doesn't exist.
@@ -122,35 +123,35 @@ static int testrados(void)
if (!rados_conf_set(cl, "config option that doesn't exist",
"some random value")) {
printf("error: succeeded in setting nonexistent config option\n");
- return 1;
+ goto out_err;
}
if (rados_conf_get(cl, "log to stderr", tmp, sizeof(tmp))) {
printf("error: failed to read log_to_stderr from config\n");
- return 1;
+ goto out_err;
}
// Can we change it?
if (rados_conf_set(cl, "log to stderr", "true")) {
printf("error: error setting log_to_stderr\n");
- return 1;
+ goto out_err;
}
if (rados_conf_get(cl, "log to stderr", tmp, sizeof(tmp))) {
printf("error: failed to read log_to_stderr from config\n");
- return 1;
+ goto out_err;
}
if (strcmp(tmp, "true")) {
printf("error: new setting for log_to_stderr failed to take effect.\n");
- return 1;
+ goto out_err;
}
if (rados_connect(cl)) {
printf("error connecting\n");
- return 1;
+ goto out_err;
}
if (rados_connect(cl) == 0) {
printf("second connect attempt didn't return an error\n");
- return 1;
+ goto out_err;
}
/* create an io_ctx */
@@ -170,7 +171,7 @@ static int testrados(void)
if (r != buf_sz) {
printf("buffer size mismatch: got %d the first time, but %d "
"the second.\n", buf_sz, r);
- return 1;
+ goto out_err;
}
const char *b = buf;
printf("begin pools.\n");
@@ -220,21 +221,21 @@ static int testrados(void)
/* attrs */
if (do_rados_setxattr(io_ctx, oid, "b", "2"))
- return 1;
+ goto out_err;
if (do_rados_setxattr(io_ctx, oid, "a", "1"))
- return 1;
+ goto out_err;
if (do_rados_setxattr(io_ctx, oid, "c", "3"))
- return 1;
+ goto out_err;
if (do_rados_getxattr(io_ctx, oid, "a", "1"))
- return 1;
+ goto out_err;
if (do_rados_getxattr(io_ctx, oid, "b", "2"))
- return 1;
+ goto out_err;
if (do_rados_getxattr(io_ctx, oid, "c", "3"))
- return 1;
+ goto out_err;
const char *exkeys[] = { "a", "b", "c", NULL };
const char *exvals[] = { "1", "2", "3", NULL };
if (do_rados_getxattrs(io_ctx, oid, exkeys, exvals))
- return 1;
+ goto out_err;
uint64_t size;
time_t mtime;
@@ -299,8 +300,10 @@ static int testrados(void)
r = rados_pool_delete(cl, "foo");
printf("rados_ioctx_pool_delete = %d\n", r);
+ ret = 0;
+out_err:
rados_shutdown(cl);
- return 0;
+ return ret;
}
int main(int argc, const char **argv)
diff --git a/src/test/filestore/test_idempotent_sequence.cc b/src/test/filestore/test_idempotent_sequence.cc
index 818a2554c35..d8f8c33ab51 100644
--- a/src/test/filestore/test_idempotent_sequence.cc
+++ b/src/test/filestore/test_idempotent_sequence.cc
@@ -91,6 +91,8 @@ int run_diff(std::string& a_path, std::string& a_journal,
dout(0) << "no diff" << dendl;
}
+ delete a;
+ delete b;
return ret;
}
@@ -99,8 +101,10 @@ int run_get_last_op(std::string& filestore_path, std::string& journal_path)
FileStore *store = new FileStore(filestore_path, journal_path);
int err = store->mount();
- if (err)
+ if (err) {
+ delete store;
return err;
+ }
coll_t txn_coll("meta");
hobject_t txn_object(sobject_t("txn", CEPH_NOSNAP));
@@ -135,6 +139,7 @@ int run_sequence_to(int val, std::string& filestore_path,
err = ::mkdir(filestore_path.c_str(), 0755);
if (err) {
cerr << filestore_path << " already exists" << std::endl;
+ delete store;
return err;
}
@@ -149,6 +154,7 @@ int run_sequence_to(int val, std::string& filestore_path,
op_sequence.generate(seed, num_txs);
store->umount();
+ delete store;
return 0;
}
diff --git a/src/test/kv_store_bench.cc b/src/test/kv_store_bench.cc
index ba5b795d95b..698105c9f39 100644
--- a/src/test/kv_store_bench.cc
+++ b/src/test/kv_store_bench.cc
@@ -373,6 +373,7 @@ int KvStoreBench::test_teuthology_aio(next_gen_t distr,
kv = (((KvStoreBench *)this)->*distr)(true);
if (kv.first == "") {
i--;
+ delete cb_args;
continue;
}
ops_in_flight++;
@@ -384,6 +385,7 @@ int KvStoreBench::test_teuthology_aio(next_gen_t distr,
kv = (((KvStoreBench *)this)->*distr)(false);
if (kv.first == "") {
i--;
+ delete cb_args;
continue;
}
ops_in_flight++;
@@ -395,6 +397,7 @@ int KvStoreBench::test_teuthology_aio(next_gen_t distr,
kv = (((KvStoreBench *)this)->*distr)(false);
if (kv.first == "") {
i--;
+ delete cb_args;
continue;
}
key_set.erase(kv.first);
@@ -406,6 +409,7 @@ int KvStoreBench::test_teuthology_aio(next_gen_t distr,
kv = (((KvStoreBench *)this)->*distr)(false);
if (kv.first == "") {
i--;
+ delete cb_args;
continue;
}
bufferlist val;
@@ -415,6 +419,10 @@ int KvStoreBench::test_teuthology_aio(next_gen_t distr,
cb_args, &cb_args->err);
break;
}
+
+ if (cb_args) {
+ delete cb_args;
+ }
}
while(ops_in_flight > 0) {
diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc
index 0094d650440..5f7b37bf2a5 100644
--- a/src/test/librbd/test_librbd.cc
+++ b/src/test/librbd/test_librbd.cc
@@ -1248,6 +1248,11 @@ static void test_list_children(rbd_image_t image, ssize_t num_expected, ...)
ASSERT_TRUE(found);
}
va_end(ap);
+
+ if (pools)
+ free(pools);
+ if (children)
+ free(children);
}
TEST(LibRBD, ListChildren)
diff --git a/src/test/test_cors.cc b/src/test/test_cors.cc
index 3c1203c8b4f..4d385bc037e 100644
--- a/src/test/test_cors.cc
+++ b/src/test/test_cors.cc
@@ -40,7 +40,8 @@ using namespace std;
extern "C" int ceph_armor(char *dst, const char *dst_end,
const char *src, const char *end);
enum key_type {
- KEY_TYPE_SWIFT = 1,
+ KEY_TYPE_UNDEFINED = 0,
+ KEY_TYPE_SWIFT,
KEY_TYPE_S3
};
@@ -65,7 +66,7 @@ class test_cors_helper {
unsigned resp_code;
key_type kt;
public:
- test_cors_helper() : resp_data(NULL){
+ test_cors_helper() : resp_data(NULL), kt(KEY_TYPE_UNDEFINED){
curl_global_init(CURL_GLOBAL_ALL);
}
~test_cors_helper(){
@@ -247,8 +248,11 @@ int test_cors_helper::send_request(string method, string res,
string s3auth;
if(get_s3_auth(method, creds, date, res, s3auth) < 0)return -1;
auth.append(string("Authorization: AWS ") + s3auth);
- }else if(kt == KEY_TYPE_SWIFT){
+ } else if(kt == KEY_TYPE_SWIFT){
auth.append(string("X-Auth-Token: ") + creds);
+ } else {
+ cout << "Unknown state (" << kt << ")\n";
+ return -1;
}
struct curl_slist *slist = NULL;
diff --git a/src/test/test_filejournal.cc b/src/test/test_filejournal.cc
index 7365e97dec0..05bd4acb89e 100644
--- a/src/test/test_filejournal.cc
+++ b/src/test/test_filejournal.cc
@@ -52,6 +52,8 @@ public:
cond.Wait(lock);
//cout << "waited" << std::endl;
lock.Unlock();
+ if (c)
+ delete c;
}
};
diff --git a/src/tools/ceph-filestore-dump.cc b/src/tools/ceph-filestore-dump.cc
index d1ec12a4f25..1c09de6c0a3 100644
--- a/src/tools/ceph-filestore-dump.cc
+++ b/src/tools/ceph-filestore-dump.cc
@@ -357,7 +357,7 @@ void remove_coll(ObjectStore *store, const coll_t &coll)
r = store->collection_list_partial(coll, next, 200, 300, 0,
&objects, &next);
if (r < 0)
- return;
+ goto out;
for (vector<hobject_t>::iterator i = objects.begin();
i != objects.end();
++i, ++num) {
@@ -380,6 +380,7 @@ void remove_coll(ObjectStore *store, const coll_t &coll)
}
t->remove_collection(coll);
store->apply_transaction(*t);
+out:
delete t;
}
@@ -437,6 +438,7 @@ int initiate_new_remove_pg(ObjectStore *store, pg_t r_pgid,
<< std::endl;
rmt->collection_rename(coll_t(r_pgid), to_remove);
} else {
+ delete rmt;
return ENOENT;
}
diff --git a/src/tools/ceph.cc b/src/tools/ceph.cc
index c28c1b200b3..b0cf91a5341 100644
--- a/src/tools/ceph.cc
+++ b/src/tools/ceph.cc
@@ -194,6 +194,7 @@ static int get_indata(const char *in_file, bufferlist &indata)
int err = errno;
derr << "error getting size of in_file '" << in_file << "': "
<< cpp_strerror(err) << dendl;
+ TEMP_FAILURE_RETRY(::close(fd));
return 1;
}
@@ -231,10 +232,11 @@ int do_admin_socket(string path, string cmd)
if (connect(fd, (struct sockaddr *) &address,
sizeof(struct sockaddr_un)) != 0) {
cerr << "connect to " << path << " failed with " << cpp_strerror(errno) << std::endl;
+ ::close(fd);
return -1;
}
- char *buf;
+ char *buf = NULL;
uint32_t len;
r = safe_write(fd, cmd.c_str(), cmd.length() + 1);
if (r < 0) {
@@ -266,6 +268,8 @@ int do_admin_socket(string path, string cmd)
r = 0;
out:
+ if (buf)
+ delete[] buf;
::close(fd);
return r;
}