]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "RWLock: don't assign the lockdep id more than once"
authorSage Weil <sage@inktank.com>
Fri, 11 Apr 2014 04:34:51 +0000 (21:34 -0700)
committerSage Weil <sage@inktank.com>
Fri, 11 Apr 2014 04:34:51 +0000 (21:34 -0700)
This reverts commit 957ac3cbe394473f225ffd2b632461fcdaca99e6.

It's important to assign these for all operations for cases where
g_lockdep isn't yet true when the constructor runs.  This is true
for the HeartbeatMap rwlock, among other things, as that thread
is created during early startup before lockdep is enabled.  All
of the lockdep hooks assume that they can assign ids on the fly
and not tracking them here breaks things.

Conflicts:

src/common/RWLock.h

src/common/RWLock.h

index cef5b0c64d2b98d5bfd848433a34fec234cea2fe..d41586a059d9a1c6bd44de2844bbadbf76ef3fb3 100644 (file)
@@ -41,19 +41,19 @@ public:
   }
 
   void unlock() const {
-    if (g_lockdep) lockdep_will_unlock(name, id);
+    if (g_lockdep) id = lockdep_will_unlock(name, id);
     pthread_rwlock_unlock(&L);
   }
 
   // read
   void get_read() const {
-    if (g_lockdep) lockdep_will_lock(name, id);
+    if (g_lockdep) id = lockdep_will_lock(name, id);
     pthread_rwlock_rdlock(&L);
-    if (g_lockdep) lockdep_locked(name, id);
+    if (g_lockdep) id = lockdep_locked(name, id);
   }
   bool try_get_read() const {
     if (pthread_rwlock_tryrdlock(&L) == 0) {
-      if (g_lockdep) lockdep_locked(name, id);
+      if (g_lockdep) id = lockdep_locked(name, id);
       return true;
     }
     return false;
@@ -64,13 +64,13 @@ public:
 
   // write
   void get_write() {
-    if (g_lockdep) lockdep_will_lock(name, id);
+    if (g_lockdep) id = lockdep_will_lock(name, id);
     pthread_rwlock_wrlock(&L);
-    if (g_lockdep) lockdep_locked(name, id);
+    if (g_lockdep) id = lockdep_locked(name, id);
   }
   bool try_get_write() {
     if (pthread_rwlock_trywrlock(&L) == 0) {
-      if (g_lockdep) lockdep_locked(name, id);
+      if (g_lockdep) id = lockdep_locked(name, id);
       return true;
     }
     return false;