Patches for glibc

Kashif Shaikh <[email protected]>
Newsgroups gmane.linux.failsafe
Message-ID <[email protected]>
Hello, if anyone missed the patches that fixed glibc problems here they 
are(attached to email): Thanks to Oliver for these great patches!

Patch instructions:

you have to apply the patches as follows

cd srctree/FailSafe/cluster_admin/cmd/cdbd/inc
patch <fs2d.diff
cd ../src
patch <attach.diff
patch <process.diff

and build / install failsafe new...


-- Kashif




Oliver Jehle wrote:

>I've posted a patch soon, that FailSafe works with glibc 2.2.4 ... se my
>posting to kashif shaikh... 
>
>due to problems (existing) with the cvs version on oss, there is no
>official version of the patch available in the moment.
>
>when oss-cvs is on the lastes version, (now it's November 2001), lars 
>he will check the patch in with small changes...
>
>In the meantime, you can work with the pachtes i sent to kashif shaikh
>on this list..
>
>
>Oliver
>
>
>
>
>
>
>
>On Thu, 2002-04-18 at 22:39, Gerard Hynes wrote:
>
>>Hi folks,
>>
>>I was wondering if anyone has made any progress on FailSafe w/RH7.2 and 
>>glibc v2.2.4.
>>
>>Thanks in advance,
>>
>>=[gh]=
>>[email protected]
>>
>>_______________________________________________
>>LinuxFailSafe mailing list
>>[email protected]
>>http://lists.community.tummy.com/mailman/listinfo/linuxfailsafe
>>
>
>
>_______________________________________________
>LinuxFailSafe mailing list
>[email protected]
>http://lists.community.tummy.com/mailman/listinfo/linuxfailsafe
>
attach.diff (text/plain, 818 B)
--- attach.c	Wed May 30 02:11:23 2001
+++ /cfs/home/oj/attach.c	Fri Apr  5 07:33:34 2002
@@ -221,6 +221,7 @@
     int		error;
     struct sigaction sa;
     pthread_mutexattr_t mutex_attr;
+    pthread_mutexattr_t mutex_xprt_attr;
     fs2_error_t 	fserror;
     int	i;
     int	fd;
@@ -245,11 +246,14 @@
     }
 
     pthread_mutexattr_init(&mutex_attr);
+    pthread_mutexattr_init(&mutex_xprt_attr);
 
     /* in case the call ever gets added to linux... */
     /* pthread_mutexattr_setprotocol(&mutex_attr,PTHREAD_PRIO_NONE); */
-
+	
+    pthread_mutex_init(&fs2d_global.xprt_close_stack_mutex,&mutex_xprt_attr);
     pthread_mutex_init(&fs2d_global.monitor,&mutex_attr);
+    pthread_mutexattr_destroy(&mutex_xprt_attr);
     pthread_mutexattr_destroy(&mutex_attr);
     fs2d_enter_monitor(&fs2d_global,NULL);
fs2d.diff (text/plain, 1.3 KB)
--- fs2d.h	Wed Mar 28 03:49:30 2001
+++ /cfs/home/oj/fs2d.h	Fri Apr  5 07:33:52 2002
@@ -375,6 +375,15 @@
 #define FS2D_POOL_MACHINE_SUBKEY_NETIF_IPADDR "ipaddr"
 #define FS2D_POOL_MACHINE_SUBKEY_NETIF_PRIORITY "priority"
 
+/* Stack Structure for xprt_close_stack */
+
+typedef struct xprt_close_stack * xprt_close_stack_ptr;
+typedef struct xprt_close_stack {
+        SVCXPRT *xprt; 
+        xprt_close_stack_ptr child;
+        xprt_close_stack_ptr parent;
+} xprt_close_stack_element;
+
 /*
  *	fs2d_global_t global data structure 
  */
@@ -388,6 +397,8 @@
 	int		service_number;
 	SVCXPRT		*xprt;
 	SVCXPRT		*xprt_table[FD_SETSIZE];
+	xprt_close_stack_ptr xprt_close_stack;
+	pthread_mutex_t      xprt_close_stack_mutex;
 	struct fs2d_process_s *process_table[FD_SETSIZE];
 
 	/* top-level database management */
@@ -930,6 +941,9 @@
 
 /* Process routines */
 extern fs2d_process_t *fs2d_locate_process(fs2d_global_t *,SVCXPRT *);
+extern void fs2d_cleanup_xprt(fs2d_global_t *);
+extern SVCXPRT * fs2d_pop_xprt(fs2d_global_t *);
+extern void fs2d_push_xprt(fs2d_global_t *,SVCXPRT *);
 extern void fs2d_destroy_process(fs2d_global_t *,fs2d_process_t *);
 extern void fs2d_process_block(fs2d_global_t *, fs2d_process_t *, bool_t);
 extern void fs2d_process_unblock(fs2d_global_t *,fs2d_process_t *);
process.diff (text/plain, 2.4 KB)
--- process.c	Thu Aug 31 03:43:24 2000
+++ /cfs/home/oj/process.c	Fri Apr  5 07:52:31 2002
@@ -66,8 +66,9 @@
 {
 	int	fd;
 	fs2d_process_t *process;
-
 	fs2d_enter_monitor(gp,NULL);
+	if(gp->master_pid == getppid()) 
+		fs2d_cleanup_xprt(gp); 
 	fd = xprt->xp_sock;
 	if (fd >= 0 &&
 	    fd < FD_SETSIZE) {
@@ -105,6 +106,67 @@
 	return(NULL);
 }
 
+bool_t
+fs2d_has_xprt(fs2d_global_t *gp) {
+	if (gp->xprt_close_stack != NULL)
+	    return TRUE;
+	return FALSE;
+}
+
+
+SVCXPRT * 
+fs2d_pop_xprt(fs2d_global_t *gp) {
+        xprt_close_stack_ptr freeElement;
+	SVCXPRT * returnElement;
+
+        pthread_mutex_lock(&gp->xprt_close_stack_mutex);
+        freeElement = gp->xprt_close_stack;
+        if (gp->xprt_close_stack != NULL) {
+                returnElement = gp->xprt_close_stack->xprt;
+                freeElement = gp->xprt_close_stack; 
+                gp->xprt_close_stack=gp->xprt_close_stack->parent;
+        }
+
+        if (freeElement != NULL)
+                free(freeElement);
+
+        pthread_mutex_unlock(&gp->xprt_close_stack_mutex);
+        return returnElement;
+}
+
+void 
+fs2d_push_xprt(fs2d_global_t *gp, SVCXPRT * in) {
+        xprt_close_stack_ptr newElement ;
+	
+	newElement = malloc(sizeof(xprt_close_stack_element));
+        newElement->xprt=in;
+       
+	 pthread_mutex_lock(&gp->xprt_close_stack_mutex);
+        if (gp->xprt_close_stack != NULL) {
+                newElement->parent = gp->xprt_close_stack;
+                gp->xprt_close_stack->child = newElement;
+        } else {
+                newElement->parent = NULL;
+	}
+        gp->xprt_close_stack = newElement;
+        pthread_mutex_unlock(&gp->xprt_close_stack_mutex);
+}
+
+void 
+fs2d_cleanup_xprt(fs2d_global_t *gp) {
+	int cnt;	
+
+/*	CBELog(&gp->fs2,CDB_LE_INTERNAL,cdb_ll_info, "fs2d check main thread... cleanup entered... "); */
+	cnt = 0;
+	/* while stack Elements available */
+	while (fs2d_has_xprt(gp) == TRUE) {	
+
+		SVC_DESTROY(fs2d_pop_xprt(gp));	
+		cnt++;
+	}
+/*	CBELog(&gp->fs2,CDB_LE_INTERNAL,cdb_ll_info, "fs2d main thread... cleanup %d SVCXPRT's", cnt); */
+}
+
 
 void
 fs2d_destroy_process(fs2d_global_t *gp,fs2d_process_t *process)
@@ -134,7 +196,10 @@
 	}
 	if (process->xprt != NULL) {
 		gp->xprt_table[process->xprt->xp_sock] = NULL;
-		SVC_DESTROY(process->xprt);
+               	if(gp->master_pid == getpid())
+                  SVC_DESTROY(process->xprt);
+                else
+		  fs2d_push_xprt(gp,process->xprt);
 		process->xprt = NULL;
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.