[Cluster-devel] cluster/dlm/lib libdlm.c
pcaulfield at sourceware.org
pcaulfield at sourceware.org
Wed Jan 31 11:16:05 UTC 2007
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: pcaulfield at sourceware.org 2007-01-31 11:16:05
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&only_with_tag=RHEL5&r1=1.32&r2=1.32.2.1
--- cluster/dlm/lib/libdlm.c 2006/07/12 07:47:47 1.32
+++ cluster/dlm/lib/libdlm.c 2007/01/31 11:16:04 1.32.2.1
@@ -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;
}
More information about the Cluster-devel
mailing list