From: Sage Weil Date: Fri, 11 Apr 2014 04:34:51 +0000 (-0700) Subject: Revert "RWLock: don't assign the lockdep id more than once" X-Git-Tag: v0.80-rc1~63^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=da0d38208b63f4cbc80391be10ecbce13dc16480;p=ceph.git Revert "RWLock: don't assign the lockdep id more than once" 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 --- diff --git a/src/common/RWLock.h b/src/common/RWLock.h index cef5b0c64d2b..d41586a059d9 100644 --- a/src/common/RWLock.h +++ b/src/common/RWLock.h @@ -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;