summaryrefslogtreecommitdiffstats
path: root/src/librados
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2012-09-25 21:39:03 +0200
committerSage Weil <sage@inktank.com>2012-09-25 21:39:03 +0200
commit5f9d01125b8e234557f44df760dace0b23fc3519 (patch)
tree61f947ca085b32f5ec6cffed7aad2bffb7b12112 /src/librados
parentmds: Adjust mydir auth when starting MDS that was stopped cleanly (diff)
parentlibrados: cleanup: use Mutex::Locker (diff)
downloadceph-5f9d01125b8e234557f44df760dace0b23fc3519.tar.xz
ceph-5f9d01125b8e234557f44df760dace0b23fc3519.zip
Merge remote-tracking branch 'gh/wip-2525'
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'src/librados')
-rw-r--r--src/librados/RadosClient.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/librados/RadosClient.cc b/src/librados/RadosClient.cc
index 08462a6c92a..56a31f81ea5 100644
--- a/src/librados/RadosClient.cc
+++ b/src/librados/RadosClient.cc
@@ -71,7 +71,9 @@ librados::RadosClient::RadosClient(CephContext *cct_)
{
}
-int64_t librados::RadosClient::lookup_pool(const char *name) {
+int64_t librados::RadosClient::lookup_pool(const char *name)
+{
+ Mutex::Locker l(lock);
int64_t ret = osdmap.lookup_pg_pool_name(name);
if (ret < 0)
return -ENOENT;
@@ -80,6 +82,7 @@ int64_t librados::RadosClient::lookup_pool(const char *name) {
const char *librados::RadosClient::get_pool_name(int64_t pool_id)
{
+ Mutex::Locker l(lock);
return osdmap.get_pool_name(pool_id);
}
@@ -231,13 +234,10 @@ void librados::RadosClient::shutdown()
uint64_t librados::RadosClient::get_instance_id()
{
- lock.Lock();
- if (state == DISCONNECTED) {
- lock.Unlock();
+ Mutex::Locker l(lock);
+ if (state == DISCONNECTED)
return 0;
- }
uint64_t id = monclient.get_global_id();
- lock.Unlock();
return id;
}
@@ -264,9 +264,9 @@ int librados::RadosClient::create_ioctx(const char *name, IoCtxImpl **io)
bool librados::RadosClient::ms_dispatch(Message *m)
{
+ Mutex::Locker l(lock);
bool ret;
- lock.Lock();
if (state == DISCONNECTED) {
ldout(cct, 10) << "disconnected, discarding " << *m << dendl;
m->put();
@@ -274,7 +274,6 @@ bool librados::RadosClient::ms_dispatch(Message *m)
} else {
ret = _dispatch(m);
}
- lock.Unlock();
return ret;
}