mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
spl-mutex: fix race in mutex_exit
Prevent race on accessing kmutex_t when the mutex is embedded in a ref counted structure. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Chunwei Chen <david.chen@osnexus.com> Signed-off-by: Gvozden Neskovic <neskovic@gmail.com> Closes zfsonlinux/zfs#6401 Closes #637
This commit is contained in:
parent
549423c0d4
commit
261a3151e1
@ -183,12 +183,13 @@ spl_mutex_lockdep_on_maybe(kmutex_t *mp) \
|
||||
*/
|
||||
#define mutex_exit(mp) \
|
||||
{ \
|
||||
spl_mutex_lockdep_off_maybe(mp); \
|
||||
spin_lock(&(mp)->m_lock); \
|
||||
spl_mutex_clear_owner(mp); \
|
||||
spin_lock(&(mp)->m_lock); \
|
||||
spl_mutex_lockdep_off_maybe(mp); \
|
||||
mutex_unlock(MUTEX(mp)); \
|
||||
spin_unlock(&(mp)->m_lock); \
|
||||
spl_mutex_lockdep_on_maybe(mp); \
|
||||
spin_unlock(&(mp)->m_lock); \
|
||||
/* NOTE: do not dereference mp after this point */ \
|
||||
}
|
||||
|
||||
int spl_mutex_init(void);
|
||||
|
Loading…
Reference in New Issue
Block a user