clnt_vc.c: Replace msleep() with pause() to avoid assert panic

An msleep() in clnt_vc.c used a global "fake_wchan" wchan argument
along with the mutex in a CLIENT structure.  As such, it was
possible to use different mutexes for the same wchan and
cause a panic assert.  Since this is in a rarely executed code
path, the assert panic was only recently observed.

Since "fake_wchan" never gets a wakeup, this msleep() can
be replaced with a pause() to avoid the panic assert,
which is what this patch does.

Reviewed by:	kib, markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D36977
This commit is contained in:
Rick Macklem 2022-10-14 15:46:55 -07:00
parent ba7319e909
commit 82512c17ea

View File

@ -116,8 +116,6 @@ static const struct clnt_ops clnt_vc_ops = {
static void clnt_vc_upcallsdone(struct ct_data *);
static int fake_wchan;
/*
* Create a client handle for a connection.
* Default options are set, which the user can change using clnt_control()'s.
@ -453,7 +451,9 @@ clnt_vc_call(
mtx_lock(&ct->ct_lock);
TAILQ_REMOVE(&ct->ct_pending, cr, cr_link);
/* Sleep for 1 clock tick before trying the sosend() again. */
msleep(&fake_wchan, &ct->ct_lock, 0, "rpclpsnd", 1);
mtx_unlock(&ct->ct_lock);
pause("rpclpsnd", 1);
mtx_lock(&ct->ct_lock);
goto call_again;
}