From: Brian Behlendorf Date: Wed, 3 Nov 2010 22:56:53 +0000 (-0700) Subject: Clear owner after dropping mutex X-Git-Tag: zfs-0.8.0-rc1~152^2~526 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8294c69bb759d2a4dc2e73f164cb37c297722ada;p=zfs Clear owner after dropping mutex 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. --- diff --git a/include/sys/mutex.h b/include/sys/mutex.h index 97f49cb2a..1a8b25813 100644 --- a/include/sys/mutex.h +++ b/include/sys/mutex.h @@ -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)