[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/dlm/lib libdlm.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	pcaulfield sourceware org	2007-01-31 10:53:47

Modified files:
	dlm/lib        : libdlm.c 

Log message:
	Read the LVB every time, rather than not at all.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm/lib/libdlm.c.diff?cvsroot=cluster&r1=1.32&r2=1.33

--- cluster/dlm/lib/libdlm.c	2006/07/12 07:47:47	1.32
+++ cluster/dlm/lib/libdlm.c	2007/01/31 10:53:47	1.33
@@ -406,14 +406,14 @@
 
 static int do_dlm_dispatch(int fd)
 {
-    struct dlm_lock_result resultbuf;
-    struct dlm_lock_result *result = &resultbuf;
+    char resultbuf[sizeof(struct dlm_lock_result) + DLM_USER_LVB_LEN];
+    struct dlm_lock_result *result = (struct dlm_lock_result *)resultbuf;
     char *fullresult = NULL;
     int status;
     void (*astaddr)(void *astarg);
 
-    /* Just read the header first */
-    status = read(fd, result, sizeof(struct dlm_lock_result));
+    /* Just read the header & LVB first */
+    status = read(fd, result, sizeof(resultbuf));
     if (status <= 0)
 	return -1;
 
@@ -433,6 +433,10 @@
 	if (newstat == result->length)
 		result = (struct dlm_lock_result *)fullresult;
     }
+    else
+    {
+	fullresult = resultbuf;
+    }
 
     /* Copy lksb to user's buffer - except the LVB ptr */
     memcpy(result->user_lksb, &result->lksb, sizeof(struct dlm_lksb) - sizeof(char*));
@@ -468,7 +472,7 @@
 	astaddr(result->user_astparam);
     }
 
-    if (fullresult)
+    if (fullresult != resultbuf)
 	free(fullresult);
     return 0;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]