This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: The recent thread sunrpc change breaks statd


On Sun, May 06, 2001 at 08:35:52PM -0700, H . J . Lu wrote:
> The recent sunrpc change breaks statd which is the part of nfs-utils.
> statd is a special rpc daemon. It has its own vesion of svc_run and
> uses svc_fdset. The problem is in sunrpc/rpc_thread.c:
> 
> fd_set *
> __rpc_thread_svc_fdset (void)
> {
>         struct rpc_thread_variables *tvp;
> 
>         tvp = __rpc_thread_variables ();
>         if (tvp == &rpc_default)
>                 return &svc_fdset;
>         return &tvp->svc_fdset_s;
> }
> 
> in statd. But __rpc_thread_variables () doesn't return &rpc_default.
> As the result, __rpc_thread_svc_fdset () doesn't return &svc_fdset
> for this special single thread rpc daemon.
> 
> The code in sunrpc/rpc_thread.c doesn't look right to me, at least
> for non-threaded applications. I will try to come up with a patch
> next week.
> 
> 

Here is a patch.


H.J.
----
2001-05-06  H.J. Lu  <hjl@gnu.org>

	* sunrpc/rpc_thread.c (__rpc_thread_destroy): Also check
	__libc_tsd_RPC_VARS_data for non-threaded applications.
	(__rpc_thread_svc_fdset): Likewise.
	(__rpc_thread_createerr): Likewise.
	(__rpc_thread_svc_pollfd): Likewise.
	(__rpc_thread_svc_max_pollfd): Likewise.

Index: sunrpc/rpc_thread.c
===================================================================
RCS file: /work/cvs/gnu/glibc/sunrpc/rpc_thread.c,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 rpc_thread.c
--- sunrpc/rpc_thread.c	2001/04/01 03:53:29	1.1.1.2
+++ sunrpc/rpc_thread.c	2001/05/07 03:42:15
@@ -26,7 +26,9 @@ __rpc_thread_destroy (void)
 {
 	struct rpc_thread_variables *tvp = __rpc_thread_variables();
 
-	if (tvp != NULL && tvp != &rpc_default) {
+	if (tvp != NULL
+	    && tvp != __libc_tsd_RPC_VARS_data
+	    && tvp != &rpc_default) {
 		__rpc_thread_svc_cleanup ();
 		__rpc_thread_clnt_cleanup ();
 		__rpc_thread_key_cleanup ();
@@ -88,7 +90,7 @@ __rpc_thread_svc_fdset (void)
 	struct rpc_thread_variables *tvp;
 
 	tvp = __rpc_thread_variables ();
-	if (tvp == &rpc_default)
+	if (tvp == __libc_tsd_RPC_VARS_data || tvp == &rpc_default)
 		return &svc_fdset;
 	return &tvp->svc_fdset_s;
 }
@@ -99,7 +101,7 @@ __rpc_thread_createerr (void)
 	struct rpc_thread_variables *tvp;
 
 	tvp = __rpc_thread_variables ();
-	if (tvp == &rpc_default)
+	if (tvp == __libc_tsd_RPC_VARS_data || tvp == &rpc_default)
 		return &rpc_createerr;
 	return &tvp->rpc_createerr_s;
 }
@@ -110,7 +112,7 @@ __rpc_thread_svc_pollfd (void)
 	struct rpc_thread_variables *tvp;
 
 	tvp = __rpc_thread_variables ();
-	if (tvp == &rpc_default)
+	if (tvp == __libc_tsd_RPC_VARS_data || tvp == &rpc_default)
 		return &svc_pollfd;
 	return &tvp->svc_pollfd_s;
 }
@@ -121,7 +123,7 @@ __rpc_thread_svc_max_pollfd (void)
 	struct rpc_thread_variables *tvp;
 
 	tvp = __rpc_thread_variables ();
-	if (tvp == &rpc_default)
+	if (tvp == __libc_tsd_RPC_VARS_data || tvp == &rpc_default)
 		return &svc_max_pollfd;
 	return &tvp->svc_max_pollfd_s;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]