Add mutex_enter_nested() as wrapper for mutex_lock_nested().
This symbol can be used by GPL modules which use the SPL to handle cases where a call path takes a two different locks by the same name. This is needed to avoid a false positive in the lock checker.
This commit is contained in:
parent
8b45dda2bc
commit
05b48408fb
@ -52,17 +52,26 @@ mutex_owner(kmutex_t *mp)
|
||||
#define MUTEX_HELD(mp) mutex_owned(mp)
|
||||
#undef mutex_init
|
||||
#define mutex_init(mp, name, type, ibc) \
|
||||
({ \
|
||||
({ \
|
||||
static struct lock_class_key __key; \
|
||||
ASSERT(type == MUTEX_DEFAULT); \
|
||||
\
|
||||
__mutex_init((mp), #mp, &__key); \
|
||||
})
|
||||
/* #define mutex_destroy(mp) ((void)0) */
|
||||
|
||||
#define mutex_tryenter(mp) mutex_trylock(mp)
|
||||
#define mutex_enter(mp) mutex_lock(mp)
|
||||
#define mutex_exit(mp) mutex_unlock(mp)
|
||||
|
||||
#ifdef HAVE_GPL_ONLY_SYMBOLS
|
||||
# define mutex_enter_nested(mp, sc) mutex_lock_nested(mp, sc)
|
||||
#else
|
||||
# define mutex_enter_nested(mp, sc) mutex_enter(mp)
|
||||
# ifdef CONFIG_DEBUG_MUTEXES
|
||||
# define mutex_destroy(mp) ((void)0)
|
||||
# endif /* CONFIG_DEBUG_MUTEXES */
|
||||
#endif /* HAVE_GPL_ONLY_SYMBOLS */
|
||||
|
||||
#else /* HAVE_MUTEX_OWNER */
|
||||
|
||||
typedef struct {
|
||||
@ -193,6 +202,19 @@ mutex_owner(kmutex_t *mp)
|
||||
mutex_unlock(MUTEX(mp)); \
|
||||
})
|
||||
|
||||
#ifdef HAVE_GPL_ONLY_SYMBOLS
|
||||
# define mutex_enter_nested(mp, sc) \
|
||||
({ \
|
||||
mutex_lock_nested(MUTEX(mp, sc)); \
|
||||
spl_mutex_set_owner(mp); \
|
||||
})
|
||||
#else
|
||||
# define mutex_enter_nested(mp, sc) \
|
||||
({ \
|
||||
mutex_enter(mp); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_MUTEX_OWNER */
|
||||
|
||||
int spl_mutex_init(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user