Skip to content

Commit

Permalink
lockdep: do not initialize if already started
Browse files Browse the repository at this point in the history
If we have already registered a cct for lockdep, do not accept another one.
We already check that the cct matches when we shut down.  This we will run
for the life span of a single cct and no longer.

Fixes: ceph#7965
Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
Sage Weil committed Apr 2, 2014
1 parent eae5a37 commit 7a49f3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/common/lockdep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,18 @@ static BackTrace *follows[MAX_LOCKS][MAX_LOCKS]; // follows[a][b] means b
void lockdep_register_ceph_context(CephContext *cct)
{
pthread_mutex_lock(&lockdep_mutex);
g_lockdep_ceph_ctx = cct;
if (g_lockdep_ceph_ctx == NULL) {
g_lockdep_ceph_ctx = cct;
lockdep_dout(0) << "lockdep start" << dendl;
}
pthread_mutex_unlock(&lockdep_mutex);
}

void lockdep_unregister_ceph_context(CephContext *cct)
{
pthread_mutex_lock(&lockdep_mutex);
if (cct == g_lockdep_ceph_ctx) {
lockdep_dout(0) << "lockdep stop" << dendl;
// this cct is going away; shut it down!
g_lockdep = false;
g_lockdep_ceph_ctx = NULL;
Expand Down Expand Up @@ -104,7 +108,6 @@ int lockdep_register(const char *name)
int id;

pthread_mutex_lock(&lockdep_mutex);

if (last_id == 0)
for (int i=0; i<MAX_LOCKS; i++)
for (int j=0; j<MAX_LOCKS; j++)
Expand Down
1 change: 0 additions & 1 deletion src/global/global_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ void global_init(std::vector < const char * > *alt_def_args,
}

if (g_lockdep) {
dout(1) << "lockdep is enabled" << dendl;
lockdep_register_ceph_context(g_ceph_context);
}
register_assert_context(g_ceph_context);
Expand Down

0 comments on commit 7a49f3d

Please sign in to comment.