Skip to content

Commit

Permalink
rgw: fix lockdep false positive
Browse files Browse the repository at this point in the history
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
  • Loading branch information
yehudasa committed Mar 23, 2016
1 parent cbc9d42 commit 4fe98c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
24 changes: 13 additions & 11 deletions src/rgw/rgw_data_sync.cc
Expand Up @@ -1182,9 +1182,12 @@ class RGWDataSyncCR : public RGWCoroutine {
}

~RGWDataSyncCR() {
shard_crs_lock.Lock();
for (auto iter : shard_crs) {
iter.second->put();
}
shard_crs.clear();
shard_crs_lock.Unlock();
}

int operate() {
Expand Down Expand Up @@ -1239,17 +1242,16 @@ class RGWDataSyncCR : public RGWCoroutine {

yield {
if ((rgw_data_sync_info::SyncState)sync_status.sync_info.state == rgw_data_sync_info::StateSync) {
case rgw_data_sync_info::StateSync:
for (map<uint32_t, rgw_data_sync_marker>::iterator iter = sync_status.sync_markers.begin();
iter != sync_status.sync_markers.end(); ++iter) {
RGWDataSyncShardControlCR *cr = new RGWDataSyncShardControlCR(sync_env, sync_env->store->get_zone_params().log_pool,
iter->first, iter->second);
cr->get();
shard_crs_lock.Lock();
shard_crs[iter->first] = cr;
shard_crs_lock.Unlock();
spawn(cr, true);
}
for (map<uint32_t, rgw_data_sync_marker>::iterator iter = sync_status.sync_markers.begin();
iter != sync_status.sync_markers.end(); ++iter) {
RGWDataSyncShardControlCR *cr = new RGWDataSyncShardControlCR(sync_env, sync_env->store->get_zone_params().log_pool,
iter->first, iter->second);
cr->get();
shard_crs_lock.Lock();
shard_crs[iter->first] = cr;
shard_crs_lock.Unlock();
spawn(cr, true);
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/rgw/rgw_sync.h
Expand Up @@ -5,6 +5,7 @@
#include "rgw_http_client.h"
#include "rgw_meta_sync_status.h"

#include "include/stringify.h"
#include "common/RWLock.h"

#define ERROR_LOGGER_SHARDS 32
Expand Down Expand Up @@ -142,7 +143,7 @@ class RGWBackoffControlCR : public RGWCoroutine
}

public:
RGWBackoffControlCR(CephContext *_cct, bool _exit_on_error) : RGWCoroutine(_cct), cr(NULL), lock("RGWBackoffControlCR::lock"),
RGWBackoffControlCR(CephContext *_cct, bool _exit_on_error) : RGWCoroutine(_cct), cr(NULL), lock("RGWBackoffControlCR::lock:" + stringify(this)),
reset_backoff(false), exit_on_error(_exit_on_error) {
}

Expand Down

0 comments on commit 4fe98c3

Please sign in to comment.