[SSI] openssi/kernel/cluster/ssi/token clitok.c, 1.7, 1.8 svrtok.c, 1.6, 1.7 tokseq.c, 1.7, 1.8

Roger Tsang <[email protected]>
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/token
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29491/cluster/ssi/token

Modified Files:
      Tag: OPENSSI-FC
	clitok.c svrtok.c tokseq.c 
Log Message:
Bug fixes and enhancements (see ChangeLog)


Index: tokseq.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/token/tokseq.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- tokseq.c	10 Oct 2008 08:10:32 -0000	1.7
+++ tokseq.c	24 Mar 2009 04:26:28 -0000	1.8
@@ -111,10 +111,10 @@
 	while ((*tqpp != NULL) &&
 	    ((tokseqnum_t)(newtqp->tsq_seq - base_seq) > (tokseqnum_t)((*tqpp)->tsq_seq - base_seq)))
 		tqpp = &((*tqpp)->tsq_next);
-	newtqp->tsq_next = *tqpp;
 #ifdef TOKEN_TOKSEQ_RACE_FIX
 	mb();
 #endif
+	newtqp->tsq_next = *tqpp;
 	*tqpp = newtqp;
 }
 

Index: svrtok.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/token/svrtok.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- svrtok.c	3 Feb 2009 06:18:13 -0000	1.6
+++ svrtok.c	24 Mar 2009 04:26:28 -0000	1.7
@@ -161,7 +161,7 @@
 
 	__list_for_each(pos, fifop) {
 		save_req = list_entry(pos, typeof(*save_req), wan_list);
-		list_del(&save_req->wan_list);
+		list_del_init(&save_req->wan_list);
 		return save_req;
 	}
 	return NULL;
@@ -205,6 +205,9 @@
 		newwant->wan_oldmode = curreq->wan_oldmode;
 		newwant->wan_newmode = curreq->wan_newmode;
 		newwant->wan_agent = curreq->wan_agent;
+#ifdef SVRTOK_KMEM_CACHE
+		newwant->wan_flags = 0;
+#endif
 		newwant->wan_tcbp = curreq->wan_tcbp;
 		svrinsertfifo(tofifop, newwant);
 	}
@@ -430,6 +433,9 @@
 			wantp->wan_oldmode = oldmode;
 			wantp->wan_newmode = newmode;
 			wantp->wan_agent = agent;
+#ifdef SVRTOK_KMEM_CACHE
+			wantp->wan_flags = 0;
+#endif
 			wantp->wan_tcbp = tcbp;
 			svrinsertfifo(&(*savepp)->nd_givefifo,
 				 wantp);
@@ -581,7 +587,7 @@
 
 			/* Toss giveback fifo */
 			list_for_each_entry_safe(wantp, tmp, &((*savepp)->nd_givefifo), wan_list) {
-				list_del(&wantp->wan_list);
+				list_del_init(&wantp->wan_list);
 				freenrwant(wantp);
 			}
 #else
@@ -679,6 +685,8 @@
 #ifdef NRSVRFIFO_LINUX_LIST
 	INIT_LIST_HEAD(&wantp->wan_list);
 #endif
+	INIT_EVENT(&(wantp->wan_done));
+	/* eek... caller responsible for initializing rest of struct nrwant */
 #else
 	LOCK_SPIN_LOCK(&nrwant_free_lock);
 	if ((wantp = nrwant_free)) {
@@ -713,7 +721,6 @@
 	wantp->wan_tcbp = NULL;
 #endif
 	wantp->wan_next = nrwant_free;
-	mb();
 	nrwant_free = wantp;
 	nrwant_free_count++;
 	UNLOCK_SPIN_LOCK(&nrwant_free_lock);
@@ -787,7 +794,7 @@
 	struct nrwant *tmp;
 
 	list_for_each_entry_safe(wantp, tmp, fifo, wan_list) {
-		list_del(&wantp->wan_list);
+		list_del_init(&wantp->wan_list);
 #else
 	/* While requests queued */
 	while((wantp = svrdeletefifo(fifo))) {
@@ -838,7 +845,7 @@
 				progress = TRUE;
 
 #ifdef NRSVRFIFO_LINUX_LIST
-				list_del(&wantp->wan_list);
+				list_del_init(&wantp->wan_list);
 #endif
 				/* Process giveback */
 				(*nodepp)->nd_mode = wantp->wan_newmode;
@@ -1314,9 +1321,7 @@
 	wantp->wan_newmode = newmode;
 	wantp->wan_flags = SVRTOK_REQUEST;
 	wantp->wan_tcbp = tcbp;
-#ifdef NRSVRFIFO_LINUX_LIST
-	INIT_LIST_HEAD(&wantp->wan_list);
-#else
+#ifndef NRSVRFIFO_LINUX_LIST
 	wantp->wan_next = NULL;
 #endif
 #ifdef SIMUL
@@ -1371,9 +1376,7 @@
 	wantp->wan_newmode = newmode;
 	wantp->wan_flags = SVRTOK_GETINSTALL;
 	wantp->wan_tcbp = tcbp;
-#ifdef NRSVRFIFO_LINUX_LIST
-	INIT_LIST_HEAD(&wantp->wan_list);
-#else
+#ifndef NRSVRFIFO_LINUX_LIST
 	wantp->wan_next = NULL;
 #endif
 
@@ -1427,9 +1430,7 @@
 	wantp->wan_newmode = newmode;
 	wantp->wan_flags = SVRTOK_SENDINSTALL;
 	wantp->wan_tcbp = tcbp;
-#ifdef NRSVRFIFO_LINUX_LIST
-	INIT_LIST_HEAD(&wantp->wan_list);
-#else
+#ifndef NRSVRFIFO_LINUX_LIST
 	wantp->wan_next = NULL;
 #endif
 
@@ -1811,7 +1812,7 @@
 	/* Clear request list */
 #ifdef NRSVRFIFO_LINUX_LIST
 	list_for_each_entry_safe(wantp, tmp, &tcbp->tok_reqfifo, wan_list) {
-		list_del(&wantp->wan_list);
+		list_del_init(&wantp->wan_list);
 #else
 	while((wantp = svrdeletefifo(&(tcbp->tok_reqfifo)))) {
 #endif
@@ -1828,7 +1829,7 @@
 		/* Delete giveback fifo */
 #ifdef NRSVRFIFO_LINUX_LIST
 		list_for_each_entry_safe(wantp, tmp, &tcbp->tok_ndlist->nd_givefifo, wan_list) {
-			list_del(&wantp->wan_list);
+			list_del_init(&wantp->wan_list);
 			freenrwant(wantp);
 		}
 #else
@@ -2005,7 +2006,7 @@
 			if (!(wantp->wan_flags & SVRTOK_QUERY) &&
 			    EQ_AGENT(wantp->wan_agent, agent)) {
 #ifdef NRSVRFIFO_LINUX_LIST
-				list_del(&wantp->wan_list);
+				list_del_init(&wantp->wan_list);
 #endif
 				freenrwant(wantp);
 			} else
@@ -2063,13 +2064,13 @@
 	wantp->wan_newmode = mode;
 	wantp->wan_flags = SVRTOK_QUERY;
 	wantp->wan_tcbp = tcbp;
-#ifdef NRSVRFIFO_LINUX_LIST
-	INIT_LIST_HEAD(&wantp->wan_list);
-#else
+#ifndef NRSVRFIFO_LINUX_LIST
 	wantp->wan_next = NULL;
 #endif
 #ifdef __KERNEL__
+#ifndef SVRTOK_KMEM_CACHE
 	INIT_EVENT(&(wantp->wan_done));
+#endif
 #elif SIMUL
 	wantp->wan_thread = curthread;
 #endif /* SIMUL */

Index: clitok.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/token/clitok.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- clitok.c	3 Feb 2009 06:18:12 -0000	1.7
+++ clitok.c	24 Mar 2009 04:26:28 -0000	1.8
@@ -536,9 +536,11 @@
 #ifdef __KERNEL__
 #ifdef CFSTOK_INTR
 	SIGNAL_INTR_EVENT(&reqp->req_done);
+	/* SSI_XXX: what if called more than once? */
 	if (tas(&reqp->req_release)) {
+		reqp->req_release = 0;
+		/* Caller should have TCB lock */
 		(void) tok_release(objp, reqp->req_tcbp, reqp->req_mode, 0);
-		tok_freereq(reqp);
 	}
 #else
 	SIGNAL_EVENT(&(reqp->req_done));
@@ -596,7 +598,7 @@
 	struct nrreq *tmp;
 
 	list_for_each_entry_safe(reqp, tmp, fifo, req_list) {
-		list_del(&reqp->req_list);
+		list_del_init(&reqp->req_list);
 #else
 	while((reqp = (struct nrreq *)deletefifo(fifo))) {
 #endif
@@ -763,6 +765,7 @@
 {
 	register struct nrreq *request = (struct nrreq *)cookie;
 #ifdef CFSTOK_INTR
+	sigset_t old_blocked;
 	int intr;
 
 	extern int tok_release(object_t *, nrtcb_t *, int, int);
@@ -775,15 +778,13 @@
 	DBG(DBGCLI,("tok_hold: wait(0x%x) request in process...\n", request));
 #ifdef __KERNEL__
 #ifdef CFSTOK_INTR
+	ssi_mask_signals(current, &old_blocked, 1);
 	WAIT_INTR_EVENT(&request->req_done, 1, &intr);
-	if (!intr) {
-		tok_freereq(request);
-	} else if (tas(&request->req_release)) {
-		/* Lost the race */
-		(void) tok_release(request->req_objp, request->req_tcbp,
-				request->req_mode, 0);
-		tok_freereq(request);
-	}
+	ssi_unmask_signals(current, &old_blocked, 1);
+	if (intr && tas(&request->req_release))
+		/* Got interrupted but also got woken */
+		intr = request->req_release = 0;
+	tok_freereq(request);
 	DBG(DBGCLI,("tok_hold: request(0x%x) complete returning\n", request));
 	return intr;
 #else /* !CFSTOK_INTR */
@@ -1040,7 +1041,7 @@
 #endif
 		if (ALLOWS(objp, newmode, request->req_mode)) {
 #ifdef TOKEN_FIFO_LINUX_LIST
-			list_del(&request->req_list);
+			list_del_init(&request->req_list);
 #endif
 
 			SSI_ASSERT((tcbp)->tok_hld_count < HLD_COUNT_MAX);


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
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.