Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Oct 2022 23:46:33 GMT
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 5484cd9b1dfd - stable/12 - clnt_vc.c: Replace msleep() with pause() to avoid assert panic
Message-ID:  <202210172346.29HNkXba023266@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=5484cd9b1dfd0f54dd559d8e803e6bb037a28f76

commit 5484cd9b1dfd0f54dd559d8e803e6bb037a28f76
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2022-10-14 22:46:55 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2022-10-17 23:44:55 +0000

    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.
    
    (cherry picked from commit 82512c17ea39fcc272483024cb55d567dfd55366)
---
 sys/rpc/clnt_vc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/rpc/clnt_vc.c b/sys/rpc/clnt_vc.c
index 0231c303f089..0b3cada47891 100644
--- a/sys/rpc/clnt_vc.c
+++ b/sys/rpc/clnt_vc.c
@@ -110,8 +110,6 @@ static 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.
@@ -423,7 +421,9 @@ call_again:
 		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;
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202210172346.29HNkXba023266>