id = lockdep_register(name.c_str());
}
void _will_lock() { // about to lock
- id = lockdep_will_lock(name.c_str(), id, backtrace);
+ id = lockdep_will_lock(name.c_str(), id, backtrace, recursive);
}
void _locked() { // just locked
id = lockdep_locked(name.c_str(), id, backtrace);
return false;
}
-int lockdep_will_lock(const char *name, int id, bool force_backtrace)
+int lockdep_will_lock(const char *name, int id, bool force_backtrace,
+ bool recursive)
{
pthread_t p = pthread_self();
p != m.end();
++p) {
if (p->first == id) {
- lockdep_dout(0) << "\n";
- *_dout << "recursive lock of " << name << " (" << id << ")\n";
- BackTrace *bt = new BackTrace(BACKTRACE_SKIP);
- bt->print(*_dout);
- if (p->second) {
- *_dout << "\npreviously locked at\n";
- p->second->print(*_dout);
+ if (!recursive) {
+ lockdep_dout(0) << "\n";
+ *_dout << "recursive lock of " << name << " (" << id << ")\n";
+ BackTrace *bt = new BackTrace(BACKTRACE_SKIP);
+ bt->print(*_dout);
+ if (p->second) {
+ *_dout << "\npreviously locked at\n";
+ p->second->print(*_dout);
+ }
+ delete bt;
+ *_dout << dendl;
+ ceph_abort();
}
- delete bt;
- *_dout << dendl;
- ceph_abort();
}
else if (!(follows[p->first][id/8] & (1 << (id % 8)))) {
// new dependency
extern void lockdep_unregister_ceph_context(CephContext *cct);
extern int lockdep_register(const char *n);
extern void lockdep_unregister(int id);
-extern int lockdep_will_lock(const char *n, int id, bool force_backtrace=false);
+extern int lockdep_will_lock(const char *n, int id, bool force_backtrace=false,
+ bool recursive=false);
extern int lockdep_locked(const char *n, int id, bool force_backtrace=false);
extern int lockdep_will_unlock(const char *n, int id);
extern int lockdep_dump_locks();