Populate the acquire context field of a ww_mutex in the LinuxKPI.

Bump the FreeBSD version to force recompilation of external kernel modules.

MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D26657
Submitted by:		greg_unrelenting.technology (Greg V)
Sponsored by:		Mellanox Technologies // NVIDIA Networking
This commit is contained in:
hselasky 2020-10-04 17:23:39 +00:00
parent 98101e6889
commit da71c38944
3 changed files with 11 additions and 5 deletions

View File

@ -76,7 +76,8 @@ ww_mutex_trylock(struct ww_mutex *lock)
return (mutex_trylock(&lock->base));
}
extern int linux_ww_mutex_lock_sub(struct ww_mutex *, int catch_signal);
extern int linux_ww_mutex_lock_sub(struct ww_mutex *,
struct ww_acquire_ctx *, int catch_signal);
static inline int
ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
@ -86,7 +87,7 @@ ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
else if ((struct thread *)SX_OWNER(lock->base.sx.sx_lock) == curthread)
return (-EALREADY);
else
return (linux_ww_mutex_lock_sub(lock, 0));
return (linux_ww_mutex_lock_sub(lock, ctx, 0));
}
static inline int
@ -97,7 +98,7 @@ ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
else if ((struct thread *)SX_OWNER(lock->base.sx.sx_lock) == curthread)
return (-EALREADY);
else
return (linux_ww_mutex_lock_sub(lock, 1));
return (linux_ww_mutex_lock_sub(lock, ctx, 1));
}
extern void linux_ww_mutex_unlock_sub(struct ww_mutex *);

View File

@ -71,7 +71,8 @@ linux_ww_unlock(void)
/* lock a mutex with deadlock avoidance */
int
linux_ww_mutex_lock_sub(struct ww_mutex *lock, int catch_signal)
linux_ww_mutex_lock_sub(struct ww_mutex *lock,
struct ww_acquire_ctx *ctx, int catch_signal)
{
struct task_struct *task;
struct ww_mutex_thread entry;
@ -126,6 +127,9 @@ linux_ww_mutex_lock_sub(struct ww_mutex *lock, int catch_signal)
if ((struct thread *)SX_OWNER(lock->base.sx.sx_lock) == NULL)
cv_signal(&lock->condvar);
}
if (retval == 0)
lock->ctx = ctx;
linux_ww_unlock();
return (retval);
}
@ -135,6 +139,7 @@ linux_ww_mutex_unlock_sub(struct ww_mutex *lock)
{
/* protect ww_mutex ownership change */
linux_ww_lock();
lock->ctx = NULL;
sx_xunlock(&lock->base.sx);
/* wakeup a lock waiter, if any */
cv_signal(&lock->condvar);

View File

@ -60,7 +60,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
#define __FreeBSD_version 1300118 /* Master, propagated to newvers */
#define __FreeBSD_version 1300119 /* Master, propagated to newvers */
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,