cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: pcaulfield@sourceware.org <pcaulfield@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/dlm/lib libdlm.c
Date: 31 Jan 2007 10:53:48 -0000	[thread overview]
Message-ID: <20070131105348.13187.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	pcaulfield at 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;
 }



             reply	other threads:[~2007-01-31 10:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-31 10:53 pcaulfield [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-01-17 16:54 [Cluster-devel] cluster/dlm/lib libdlm.c cfeist
2008-01-17  9:40 pcaulfield
2008-01-16 17:25 pcaulfield
2007-10-17 18:13 teigland
2007-07-05  8:24 pcaulfield
2007-07-05  8:08 pcaulfield
2007-05-31 13:46 pcaulfield
2007-01-31 11:16 pcaulfield
2006-07-12  7:47 pcaulfield

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070131105348.13187.qmail@sourceware.org \
    --to=pcaulfield@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).