FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 01-02-2008, 06:31 PM
Lon Hohberger
 
Default Make rgmanager flip rg states when storing.

On Wed, 2008-01-02 at 14:14 -0500, Lon Hohberger wrote:
> Patch is against head. This might break upgrade compatibility. A more
> robust patch including endian detection will be required for -RHEL5

This one was memcpy()ing the wrong size. Here's a new one.

-- Lon


Index: rg_state.c
================================================== =================
RCS file: /cvs/cluster/cluster/rgmanager/src/daemons/rg_state.c,v
retrieving revision 1.44
diff -u -p -r1.44 rg_state.c
--- rg_state.c 30 Dec 2007 08:27:21 -0000 1.44
+++ rg_state.c 2 Jan 2008 19:30:49 -0000
@@ -270,6 +270,7 @@ int
set_rg_state(char *name, rg_state_t *svcblk)
{
char res[256];
+ rg_state_t svcblk_store;
#ifndef OPENAIS
cluster_member_list_t *membership;
int ret, tries = 0;
@@ -279,8 +280,12 @@ set_rg_state(char *name, rg_state_t *svc
strncpy(svcblk->rs_name, name, sizeof(svcblk->rs_name));

snprintf(res, sizeof(res), "rg="%s"", name);
+
+ memcpy(&svcblk_store, svcblk, sizeof(svcblk_store));
+ swab_rg_state_t(&svcblk_store);
+
#ifdef OPENAIS
- if (ds_write(res, svcblk, sizeof(*svcblk)) < 0)
+ if (ds_write(res, &svcblk_store, sizeof(svcblk_store)) < 0)
return -1;
return 0;
#else
@@ -288,8 +293,9 @@ set_rg_state(char *name, rg_state_t *svc
/* Retry up to 3 times just in case members transition
while we're trying to commit something */
membership = member_list();
- ret = vf_write(membership, VFF_IGN_CONN_ERRORS, res, svcblk,
- sizeof(*svcblk));
+ ret = vf_write(membership, VFF_IGN_CONN_ERRORS, res,
+ &svcblk_store,
+ sizeof(svcblk_store));
free_member_list(membership);
} while (ret == VFR_TIMEOUT && ++tries < 3);

@@ -360,6 +366,7 @@ get_rg_state(char *name, rg_state_t *svc
}

memcpy(svcblk, data, sizeof(*svcblk));
+ swab_rg_state_t(svcblk);

return 0;
#else
@@ -399,6 +406,7 @@ get_rg_state(char *name, rg_state_t *svc

/* Copy out the data. */
memcpy(svcblk, data, sizeof(*svcblk));
+ swab_rg_state_t(svcblk);
free(data);
free_member_list(membership);

@@ -452,6 +460,7 @@ get_rg_state_local(char *name, rg_state_

/* Copy out the data. */
memcpy(svcblk, data, sizeof(*svcblk));
+ swab_rg_state_t(svcblk);
#ifndef OPENAIS
free(data);
#endif
 
Old 01-02-2008, 06:39 PM
"Fabio M. Di Nitto"
 
Default Make rgmanager flip rg states when storing.

ACK.. works fine here... but you know that.

Fabio

On Wed, 2 Jan 2008, Lon Hohberger wrote:


On Wed, 2008-01-02 at 14:14 -0500, Lon Hohberger wrote:

Patch is against head. This might break upgrade compatibility. A more
robust patch including endian detection will be required for -RHEL5


This one was memcpy()ing the wrong size. Here's a new one.

-- Lon


Index: rg_state.c
================================================== =================
RCS file: /cvs/cluster/cluster/rgmanager/src/daemons/rg_state.c,v
retrieving revision 1.44
diff -u -p -r1.44 rg_state.c
--- rg_state.c 30 Dec 2007 08:27:21 -0000 1.44
+++ rg_state.c 2 Jan 2008 19:30:49 -0000
@@ -270,6 +270,7 @@ int
set_rg_state(char *name, rg_state_t *svcblk)
{
char res[256];
+ rg_state_t svcblk_store;
#ifndef OPENAIS
cluster_member_list_t *membership;
int ret, tries = 0;
@@ -279,8 +280,12 @@ set_rg_state(char *name, rg_state_t *svc
strncpy(svcblk->rs_name, name, sizeof(svcblk->rs_name));

snprintf(res, sizeof(res), "rg="%s"", name);
+
+ memcpy(&svcblk_store, svcblk, sizeof(svcblk_store));
+ swab_rg_state_t(&svcblk_store);
+
#ifdef OPENAIS
- if (ds_write(res, svcblk, sizeof(*svcblk)) < 0)
+ if (ds_write(res, &svcblk_store, sizeof(svcblk_store)) < 0)
return -1;
return 0;
#else
@@ -288,8 +293,9 @@ set_rg_state(char *name, rg_state_t *svc
/* Retry up to 3 times just in case members transition
while we're trying to commit something */
membership = member_list();
- ret = vf_write(membership, VFF_IGN_CONN_ERRORS, res, svcblk,
- sizeof(*svcblk));
+ ret = vf_write(membership, VFF_IGN_CONN_ERRORS, res,
+ &svcblk_store,
+ sizeof(svcblk_store));
free_member_list(membership);
} while (ret == VFR_TIMEOUT && ++tries < 3);

@@ -360,6 +366,7 @@ get_rg_state(char *name, rg_state_t *svc
}

memcpy(svcblk, data, sizeof(*svcblk));
+ swab_rg_state_t(svcblk);

return 0;
#else
@@ -399,6 +406,7 @@ get_rg_state(char *name, rg_state_t *svc

/* Copy out the data. */
memcpy(svcblk, data, sizeof(*svcblk));
+ swab_rg_state_t(svcblk);
free(data);
free_member_list(membership);

@@ -452,6 +460,7 @@ get_rg_state_local(char *name, rg_state_

/* Copy out the data. */
memcpy(svcblk, data, sizeof(*svcblk));
+ swab_rg_state_t(svcblk);
#ifndef OPENAIS
free(data);
#endif





--
I'm going to make him an offer he can't refuse.
 

Thread Tools




All times are GMT. The time now is 12:04 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org