]> git.proxmox.com Git - mirror_spl.git/commitdiff
Clear owner after dropping mutex
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 3 Nov 2010 22:56:53 +0000 (15:56 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 5 Nov 2010 18:52:30 +0000 (11:52 -0700)
It's important to clear mp->owner after calling mutex_unlock()
because when CONFIG_DEBUG_MUTEXES is defined the mutex owner
is verified in mutex_unlock().  If we set it to NULL this check
fails and the lockdep support is immediately disabled.

include/sys/mutex.h

index 97f49cb2acd2cfae2e4af563dc43cd8aab97056a..1a8b2581343c48783fd696a7eb012ec3f8f78c4d 100644 (file)
@@ -81,8 +81,8 @@ mutex_owned(kmutex_t *mp)
 #ifdef CONFIG_DEBUG_MUTEXES
 # define mutex_exit(mp)                                                 \
 ({                                                                      \
-         (mp)->owner = NULL;                                            \
-        mutex_unlock(mp);                                              \
+        mutex_unlock(mp);                                               \
+        (mp)->owner = NULL;                                             \
 })
 #else
 # define mutex_exit(mp)                 mutex_unlock(mp)