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-18-2008, 04:11 PM
 
Default cluster/cmirror/src cluster.c functions.c loca ...

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: jbrassow@sourceware.org 2008-01-18 17:11:07

Modified files:
cmirror/src : cluster.c functions.c local.c logging.h
rbtree.c

Log message:
- fix compile problems on x86_64

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/cluster.c.diff?cvsroot=cluster&only_with_tag=RHEL5 &r1=1.1.2.8&r2=1.1.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/functions.c.diff?cvsroot=cluster&only_with_tag=RHE L5&r1=1.1.2.8&r2=1.1.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/local.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r 1=1.1.2.7&r2=1.1.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/logging.h.diff?cvsroot=cluster&only_with_tag=RHEL5 &r1=1.1.2.3&r2=1.1.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/rbtree.c.diff?cvsroot=cluster&only_with_tag=RHEL5& r1=1.1.2.3&r2=1.1.2.4

--- cluster/cmirror/src/Attic/cluster.c 2008/01/14 22:52:17 1.1.2.8
+++ cluster/cmirror/src/Attic/cluster.c 2008/01/18 17:11:07 1.1.2.9
@@ -165,7 +165,7 @@
LOG_DBG("Sending response to %u on cluster: [%s/%llu]",
tfr->originator,
RQ_TYPE(tfr->request_type & ~DM_CLOG_RESPONSE),
- tfr->seq);
+ (unsigned long long)tfr->seq);
r = cluster_send(tfr);
if (r)
LOG_ERROR("cluster_send failed");
@@ -624,10 +624,11 @@
LOG_DBG("Response to %u from %u recieved [%s/%llu]",
tfr->originator, nodeid,
RQ_TYPE(tfr->request_type & ~DM_CLOG_RESPONSE),
- tfr->seq);
+ (unsigned long long)tfr->seq);
else
LOG_DBG("Request from %u recieved [%s/%llu]",
- nodeid, RQ_TYPE(tfr->request_type), tfr->seq);
+ nodeid, RQ_TYPE(tfr->request_type),
+ (unsigned long long)tfr->seq);

if (my_cluster_id == 0xDEAD) {
LOG_DBG("Message before init... ignoring.
");
@@ -757,8 +758,8 @@
LOG_PRINT("*************************************** **");

list_for_each_entry_safe(match, tmp, &clog_cpg_list, list) {
- LOG_DBG("Given handle: %llu", handle);
- LOG_DBG(" hanlde: %llu", match->handle);
+ LOG_DBG("Given handle: %llu", (unsigned long long)handle);
+ LOG_DBG(" hanlde: %llu", (unsigned long long)match->handle);
LOG_DBG("Given name : %s", gname->value);
LOG_DBG(" name : %s", match->name.value);
if (match->handle == handle) {
@@ -928,7 +929,7 @@
}

list_add(&new->list, &clog_cpg_list);
- LOG_DBG("New handle: %llu", new->handle);
+ LOG_DBG("New handle: %llu", (unsigned long long)new->handle);
LOG_DBG("New name: %s", new->name.value);

/* FIXME: better variable */
--- cluster/cmirror/src/Attic/functions.c 2008/01/15 22:01:18 1.1.2.8
+++ cluster/cmirror/src/Attic/functions.c 2008/01/18 17:11:07 1.1.2.9
@@ -245,7 +245,8 @@
LOG_ERROR(" magic : %x (expected: %x)",
lh.magic, MIRROR_MAGIC);
LOG_ERROR(" version : %u", lh.version);
- LOG_ERROR(" nr_regions: %llu", lh.nr_regions);
+ LOG_ERROR(" nr_regions: %llu",
+ (unsigned long long)lh.nr_regions);
LOG_ERROR("*** %s ***", strerror(EINVAL));
return -EINVAL;
}
@@ -569,8 +570,9 @@
if (strlen(tfr->data) != tfr->data_size) {
LOG_ERROR("Received constructor request with bad data");
LOG_DBG("strlen(tfr->data)[%d] != tfr->data_size[%d]",
- strlen(tfr->data), tfr->data_size);
- LOG_DBG("tfr->data = '%s' [%d]", tfr->data, strlen(tfr->data));
+ (int)strlen(tfr->data), tfr->data_size);
+ LOG_DBG("tfr->data = '%s' [%d]",
+ tfr->data, (int)strlen(tfr->data));
return -EINVAL;
}

@@ -746,7 +748,8 @@
lc->resume_override = 1000;
lc->sync_count = count_bits32(lc->clean_bits, lc->bitset_uint32_count);
LOG_DBG("[%s] Initial sync_count = %llu",
- SHORT_UUID(lc->uuid), lc->sync_count);
+ SHORT_UUID(lc->uuid),
+ (unsigned long long)lc->sync_count);
goto out;
default:
LOG_ERROR("Error:: multiple loading of bits (%d)", lc->resume_override);
@@ -796,7 +799,7 @@
memcpy(lc->sync_bits, lc->clean_bits, size);
lc->sync_count = count_bits32(lc->clean_bits, lc->bitset_uint32_count);
LOG_DBG("[%s] Initial sync_count = %llu",
- SHORT_UUID(lc->uuid), lc->sync_count);
+ SHORT_UUID(lc->uuid), (unsigned long long)lc->sync_count);
lc->sync_search = 0;

/*
@@ -919,10 +922,10 @@
*rtn = log_test_bit(lc->sync_bits, region);
if (*rtn)
LOG_DBG("[%s] Region is in-sync: %llu",
- SHORT_UUID(lc->uuid), region);
+ SHORT_UUID(lc->uuid), (unsigned long long)region);
else
LOG_DBG("[%s] Region is not in-sync: %llu",
- SHORT_UUID(lc->uuid), region);
+ SHORT_UUID(lc->uuid), (unsigned long long)region);

tfr->data_size = sizeof(*rtn);

@@ -987,7 +990,7 @@
new = rbt_alloc_node(&lc->mark_tree);
if (!new) {
LOG_ERROR("Unable to allocate space for mark_entry: %llu/%u",
- region, who);
+ (unsigned long long)region, who);
return -ENOMEM;
}

@@ -1047,7 +1050,7 @@
mark_list = rbt_search_plus(&lc->mark_tree, &region, srsm_count, &who);
if (!mark_list || !srsm_count_var) {
LOG_DBG("[%s] Clear issued by %u on region not marked: %llu",
- SHORT_UUID(lc->uuid), who, region);
+ SHORT_UUID(lc->uuid), who, (unsigned long long)region);
goto set_bit;
}

@@ -1142,8 +1145,9 @@
}

if (lc->recovering_region != (uint64_t)-1) {
- LOG_DBG("[%s] Someone is already recovering region %Lu",
- SHORT_UUID(lc->uuid), lc->recovering_region);
+ LOG_DBG("[%s] Someone is already recovering region %llu",
+ SHORT_UUID(lc->uuid),
+ (unsigned long long)lc->recovering_region);
pkg->i = 0;
return 0;
}
@@ -1159,13 +1163,14 @@

if (!log_test_bit(lc->sync_bits, pkg->r)) {
LOG_DBG("[%s] Assigning priority resync work to %u: %llu",
- SHORT_UUID(lc->uuid), tfr->originator, pkg->r);
+ SHORT_UUID(lc->uuid), tfr->originator,
+ (unsigned long long)pkg->r);
#ifdef DEBUG
LOG_DBG("[%s] Priority work remaining:",
SHORT_UUID(lc->uuid));
for (del = lc->recovery_request_list; del; del = del->next)
LOG_DBG("[%s] %llu", SHORT_UUID(lc->uuid),
- del->region);
+ (unsigned long long)del->region);
#endif
pkg->i = 1;
lc->recovering_region = pkg->r;
@@ -1185,7 +1190,8 @@
lc->sync_search = pkg->r + 1;

LOG_DBG("[%s] Assigning resync work to %u: region = %llu
",
- SHORT_UUID(lc->uuid), tfr->originator, pkg->r);
+ SHORT_UUID(lc->uuid), tfr->originator,
+ (unsigned long long)pkg->r);
pkg->i = 1;
lc->recovering_region = pkg->r;
return 0;
@@ -1208,20 +1214,20 @@
if (pkg->in_sync) {
if (log_test_bit(lc->sync_bits, pkg->region)) {
LOG_PRINT(" Region already in-sync: %llu",
- pkg->region);
+ (unsigned long long)pkg->region);
} else {
log_set_bit(lc, lc->sync_bits, pkg->region);
lc->sync_count++;
LOG_DBG("[%s] sync_count = %llu, Region %llu marked in-sync by %u",
- SHORT_UUID(lc->uuid), lc->sync_count,
- pkg->region, tfr->originator);
+ SHORT_UUID(lc->uuid), (unsigned long long)lc->sync_count,
+ (unsigned long long)pkg->region, tfr->originator);
}
} else if (log_test_bit(lc->sync_bits, pkg->region)) {
lc->sync_count--;
log_clear_bit(lc, lc->sync_bits, pkg->region);
LOG_DBG("[%s] sync_count = %llu, Region %llu marked not in-sync by %u",
- SHORT_UUID(lc->uuid), lc->sync_count,
- pkg->region, tfr->originator);
+ SHORT_UUID(lc->uuid), (unsigned long long)lc->sync_count,
+ (unsigned long long)pkg->region, tfr->originator);
}

tfr->data_size = 0;
@@ -1368,7 +1374,7 @@

if (lc->recovery_halted) {
LOG_DBG("[%s] Recovery halted... [not remote recovering]: %llu",
- SHORT_UUID(lc->uuid), region);
+ SHORT_UUID(lc->uuid), (unsigned long long)region);
*rtn = 0;
} else {
*rtn = !log_test_bit(lc->sync_bits, region);
@@ -1377,7 +1383,7 @@
(region == lc->recovering_region) ?
"currently remote recovering" :
(*rtn) ? "pending remote recovery" :
- "not remote recovering", region);
+ "not remote recovering", (unsigned long long)region);
}

if (*rtn && (region != lc->recovering_region)) {
@@ -1394,7 +1400,7 @@
goto out;

LOG_DBG("[%s] Adding region to priority list: %llu",
- SHORT_UUID(lc->uuid), region);
+ SHORT_UUID(lc->uuid), (unsigned long long)region);
rr->region = region;
rr->next = lc->recovery_request_list;
lc->recovery_request_list = rr;
--- cluster/cmirror/src/Attic/local.c 2008/01/15 22:01:18 1.1.2.7
+++ cluster/cmirror/src/Attic/local.c 2008/01/18 17:11:07 1.1.2.8
@@ -152,7 +152,8 @@
return r;

LOG_DBG("Request from kernel recieved [%s/%s/%llu]",
- RQ_TYPE(tfr->request_type), SHORT_UUID(tfr->uuid), tfr->seq);
+ RQ_TYPE(tfr->request_type), SHORT_UUID(tfr->uuid),
+ (unsigned long long)tfr->seq);
switch (tfr->request_type) {
case DM_CLOG_CTR:
case DM_CLOG_DTR:
--- cluster/cmirror/src/Attic/logging.h 2008/01/14 22:52:17 1.1.2.3
+++ cluster/cmirror/src/Attic/logging.h 2008/01/18 17:11:07 1.1.2.4
@@ -4,6 +4,30 @@
#include <stdio.h>
#include <syslog.h>

+#if (BITS_PER_LONG == 64)
+#define PRIu64 "lu"
+#define PRId64 "ld"
+#define PRIo64 "lo"
+#define PRIx64 "lx"
+#define PRIX64 "lX"
+#define SCNu64 "lu"
+#define SCNd64 "ld"
+#define SCNo64 "lo"
+#define SCNx64 "lx"
+#define SCNX64 "lX"
+#else
+#define PRIu64 "Lu"
+#define PRId64 "Ld"
+#define PRIo64 "Lo"
+#define PRIx64 "Lx"
+#define PRIX64 "LX"
+#define SCNu64 "Lu"
+#define SCNd64 "Ld"
+#define SCNo64 "Lo"
+#define SCNx64 "Lx"
+#define SCNX64 "LX"
+#endif
+
/* SHORT_UUID - print last 8 chars of a string */
#define SHORT_UUID(x) ((x) + (strlen(x) - 8))

--- cluster/cmirror/src/Attic/rbtree.c 2008/01/14 22:52:17 1.1.2.3
+++ cluster/cmirror/src/Attic/rbtree.c 2008/01/18 17:11:07 1.1.2.4
@@ -57,7 +57,7 @@
}

LOG_DBG("TREE[0x%p]: left_rotate [axis = %llu]",
- t, *((uint64_t *)KEY(axis)));
+ t, (unsigned long long)*((uint64_t *)KEY(axis)));
tmp = RIGHT(axis);
RIGHT(axis) = LEFT(tmp);
if (LEFT(tmp) != NIL(t))
@@ -87,7 +87,7 @@
}

LOG_DBG("TREE[0x%p]: right_rotate [axis = %llu]",
- t, *((uint64_t *)KEY(axis)));
+ t, (unsigned long long)*((uint64_t *)KEY(axis)));
tmp = LEFT(axis);
LEFT(axis) = RIGHT(tmp);
if (RIGHT(tmp) != NIL(t))
@@ -179,7 +179,7 @@
struct rb_node *tmp;

LOG_DBG("TREE[0x%p]: inserting %llu",
- t, *((uint64_t *)KEY(new)));
+ t, (unsigned long long)*((uint64_t *)KEY(new)));
if (!t || !new) {
errno = EINVAL;
return -1;
@@ -320,7 +320,7 @@
struct rb_node *x, *y;

LOG_DBG("TREE[0x%p]: removing %llu",
- t, *((uint64_t *)KEY(del)));
+ t, (unsigned long long)*((uint64_t *)KEY(del)));
if ((LEFT(del) == NIL(t)) || (RIGHT(del) == NIL(t)))
y = del;
else
 
Old 02-04-2008, 05:27 PM
 
Default cluster/cmirror/src cluster.c functions.c loca ...

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: jbrassow@sourceware.org 2008-02-04 18:27:20

Modified files:
cmirror/src : cluster.c functions.c local.c logging.h

Log message:
- change priority of some log statements
- fix potential OOB memory op by macro
- add reference counting to log... fixes some issues with mirror conversion
- plug a memory leak... likely related to bug 383291

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/cluster.c.diff?cvsroot=cluster&only_with_tag=RHEL5 &r1=1.1.2.11&r2=1.1.2.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/functions.c.diff?cvsroot=cluster&only_with_tag=RHE L5&r1=1.1.2.10&r2=1.1.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/local.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r 1=1.1.2.10&r2=1.1.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/logging.h.diff?cvsroot=cluster&only_with_tag=RHEL5 &r1=1.1.2.4&r2=1.1.2.5

--- cluster/cmirror/src/Attic/cluster.c 2008/01/23 21:21:06 1.1.2.11
+++ cluster/cmirror/src/Attic/cluster.c 2008/02/04 18:27:20 1.1.2.12
@@ -335,7 +335,7 @@
}

if (rv == SA_AIS_ERR_EXIST) {
- LOG_ERROR("export_checkpoint: checkpoint already exists");
+ LOG_DBG("export_checkpoint: checkpoint already exists");
EXIT();
return -EEXIST;
}
@@ -361,7 +361,7 @@
}

if (rv == SA_AIS_ERR_EXIST) {
- LOG_ERROR("export_checkpoint: sync checkpoint section already exists");
+ LOG_DBG("export_checkpoint: sync checkpoint section already exists");
EXIT();
return -EEXIST;
}
@@ -588,8 +588,8 @@
}

for (cp = entry->checkpoint_list; cp {
- LOG_ERROR("Checkpoint data available for node %u",
- cp->requester);
+ LOG_DBG("[%s] Checkpoint data available for node %u",
+ SHORT_UUID(entry->name.value), cp->requester);

/*
* FIXME: Check return code. Could send failure
@@ -747,24 +747,25 @@

ENTER();

- LOG_PRINT("****** CPG config callback ****************");
+ LOG_DBG("****** CPG config callback **[%s]**",
+ SHORT_UUID(gname->value));

- LOG_PRINT("* JOINING (%d):", joined_list_entries);
+ LOG_DBG("* JOINING (%d):", joined_list_entries);
for (i = 0; i < joined_list_entries; i++)
- LOG_PRINT("* nodeid: %d, pid: %d",
- joined_list[i].nodeid, joined_list[i].pid);
+ LOG_DBG("* nodeid: %d, pid: %d",
+ joined_list[i].nodeid, joined_list[i].pid);

- LOG_PRINT("* MEMBERS (%d):", member_list_entries);
+ LOG_DBG("* MEMBERS (%d):", member_list_entries);
for (i = 0; i < member_list_entries; i++)
- LOG_PRINT("* nodeid: %d, pid: %d",
- member_list[i].nodeid, member_list[i].pid);
+ LOG_DBG("* nodeid: %d, pid: %d",
+ member_list[i].nodeid, member_list[i].pid);

- LOG_PRINT("* LEAVING (%d):", left_list_entries);
+ LOG_DBG("* LEAVING (%d):", left_list_entries);
for (i = 0; i < left_list_entries; i++)
- LOG_PRINT("* nodeid: %d, pid: %d",
- left_list[i].nodeid, left_list[i].pid);
+ LOG_DBG("* nodeid: %d, pid: %d",
+ left_list[i].nodeid, left_list[i].pid);

- LOG_PRINT("*************************************** **");
+ LOG_DBG("***************************************** ");

list_for_each_entry_safe(match, tmp, &clog_cpg_list, list) {
LOG_DBG("Given handle: %llu", (unsigned long long)handle);
--- cluster/cmirror/src/Attic/functions.c 2008/01/23 21:21:06 1.1.2.10
+++ cluster/cmirror/src/Attic/functions.c 2008/02/04 18:27:20 1.1.2.11
@@ -43,7 +43,9 @@

struct log_c {
struct list_head list;
+
char uuid[DM_UUID_LEN];
+ uint32_t ref_count;

int touched;
uint32_t region_size;
@@ -350,6 +352,7 @@
uint64_t region_count;
uint32_t bitset_size;
struct log_c *lc = NULL;
+ struct log_c *dup;
enum sync sync = DEFAULTSYNC;

int disk_log = 0;
@@ -422,9 +425,19 @@
lc->sync = sync;
lc->sync_search = 0;
lc->recovering_region = (uint64_t)-1;
- strncpy(lc->uuid, argv[1 + disk_log], DM_UUID_LEN);
lc->disk_fd = -1;
lc->log_dev_failed = 0;
+ lc->ref_count = 1;
+ strncpy(lc->uuid, argv[1 + disk_log], DM_UUID_LEN);
+
+ if ((dup = get_log(lc->uuid)) ||
+ (dup = get_pending_log(lc->uuid))) {
+ LOG_PRINT("[%s] Inc reference count on cluster log",
+ SHORT_UUID(lc->uuid));
+ free(lc);
+ dup->ref_count++;
+ return 0;
+ }

INIT_LIST_HEAD(&lc->mark_list);

@@ -561,7 +574,8 @@
if (r)
LOG_ERROR("Failed to create cluster log (%s)", tfr->uuid);
else
- LOG_PRINT("Cluster log created (%s)", tfr->uuid);
+ LOG_PRINT("[%s] Cluster log created",
+ SHORT_UUID(tfr->uuid));

return r;
}
@@ -575,23 +589,31 @@
{
struct log_c *lc = get_log(tfr->uuid);

- if (!lc) {
- /* Is the log in the pending list? */
- lc = get_pending_log(tfr->uuid);
- if (!lc) {
- LOG_ERROR("clog_dtr called on log that is not official or pending");
- return -EINVAL;
- }
- } else {
- LOG_DBG("[%s] clog_dtr: leaving CPG", SHORT_UUID(lc->uuid));
+ if (lc) {
/*
- * If postsuspend had done the destroy_cluster_cpg,
- * the log context would be in the pending list
+ * The log should not be on the official list. There
+ * should have been a suspend first.
*/
- destroy_cluster_cpg(tfr->uuid);
+ lc->ref_count--;
+ if (!lc->ref_count) {
+ LOG_ERROR("[%s] DTR before SUS: leaving CPG",
+ SHORT_UUID(tfr->uuid));
+ destroy_cluster_cpg(tfr->uuid);
+ }
+ } else if ((lc = get_pending_log(tfr->uuid))) {
+ lc->ref_count--;
+ } else {
+ LOG_ERROR("clog_dtr called on log that is not official or pending");
+ return -EINVAL;
+ }
+
+ if (lc->ref_count) {
+ LOG_PRINT("[%s] Dec reference count on cluster log",
+ SHORT_UUID(lc->uuid));
+ return 0;
}

- LOG_PRINT("Cluster log removed (%s)", lc->uuid);
+ LOG_PRINT("[%s] Cluster log removed", SHORT_UUID(lc->uuid));

list_del_init(&lc->list);
if (lc->disk_fd != -1)
@@ -638,7 +660,7 @@
if (!lc)
return -EINVAL;

- LOG_DBG("[%s] clog_postsuspend: leaving CPG", SHORT_UUID(lc->uuid));
+ LOG_PRINT("[%s] clog_postsuspend: leaving CPG", SHORT_UUID(lc->uuid));
destroy_cluster_cpg(tfr->uuid);

return 0;
@@ -656,7 +678,7 @@
if (!lc)
return -EINVAL;

- LOG_DBG("[%s] clog_postsuspend: finalizing", SHORT_UUID(lc->uuid));
+ LOG_PRINT("[%s] clog_postsuspend: finalizing", SHORT_UUID(lc->uuid));
lc->resume_override = 0;

/* move log to pending list */
@@ -686,10 +708,12 @@

switch (lc->resume_override) {
case 1000:
- LOG_ERROR("ERROR:: Additional resume issued before suspend");
+ LOG_ERROR("[%s] ERROR:: Additional resume issued before suspend",
+ SHORT_UUID(tfr->uuid));
return 0;
case 0:
- LOG_PRINT("Master resume: reading disk log");
+ LOG_PRINT("[%s] Master resume: reading disk log",
+ SHORT_UUID(lc->uuid));
lc->resume_override = 1000;
break;
case 1:
@@ -699,8 +723,8 @@
LOG_ERROR("Error:: partial bit loading (just clean_bits)");
return -EINVAL;
case 3:
- LOG_DBG("[%s] Non-master resume: bits pre-loaded",
- SHORT_UUID(lc->uuid));
+ LOG_PRINT("[%s] Non-master resume: bits pre-loaded",
+ SHORT_UUID(lc->uuid));
lc->resume_override = 1000;
lc->sync_count = count_bits32(lc->clean_bits, lc->bitset_uint32_count);
LOG_DBG("[%s] Initial sync_count = %llu",
@@ -1232,6 +1256,9 @@
struct log_c *lc = get_log(tfr->uuid);

if (!lc)
+ lc = get_pending_log(tfr->uuid);
+
+ if (!lc)
return -EINVAL;

if (lc->disk_fd == -1)
@@ -1287,6 +1314,9 @@
struct log_c *lc = get_log(tfr->uuid);

if (!lc)
+ lc = get_pending_log(tfr->uuid);
+
+ if (!lc)
return -EINVAL;

if (lc->disk_fd == -1)
--- cluster/cmirror/src/Attic/local.c 2008/01/25 16:24:47 1.1.2.10
+++ cluster/cmirror/src/Attic/local.c 2008/02/04 18:27:20 1.1.2.11
@@ -16,8 +16,6 @@
#include "local.h"

static int cn_fd; /* Connector (netlink) socket fd */
-static int request_array[20]; /* for request counting (debugging) */
-static int cluster_array[20]; /* for request counting (debugging) */

static int kernel_recv_helper(void *data, int in_size)
{
@@ -145,7 +143,6 @@
*/
static int do_local_work(void *data)
{
- static int request_count = 0;
int r, i;
struct clog_tfr *tfr = NULL;

@@ -154,9 +151,6 @@
if (r)
return r;

- request_array[tfr->request_type]++;
- request_count++;
-
LOG_DBG("Request from kernel recieved [%s/%s/%llu]",
RQ_TYPE(tfr->request_type), SHORT_UUID(tfr->uuid),
(unsigned long long)tfr->seq);
@@ -208,13 +202,22 @@
}
/* ELSE, fall through to default */
default:
- cluster_array[tfr->request_type]++;
- /* Add before send_to_cluster, so cluster code can find it */
- queue_add_tail(tfr, cluster_queue);
r = cluster_send(tfr);
- if (r)
- LOG_ERROR("Unable to send request to cluster: %s",
- strerror(-r));
+ if (r) {
+ LOG_ERROR("[%s] Unable to send %s to cluster: %s",
+ SHORT_UUID(tfr->uuid),
+ RQ_TYPE(tfr->request_type), strerror(-r));
+ tfr->error = r;
+ kernel_send(tfr);
+ } else {
+ /*
+ * If this was multi-threaded, we would have to
+ * add the 'tfr' to the queue before doing
+ * the cluster_send
+ */
+ queue_add_tail(tfr, cluster_queue);
+ }
+
break;
}

@@ -223,14 +226,6 @@
tfr->error = r;
}

- if (!(request_count % 10000)) {
- LOG_PRINT("Total requests (%d):", request_count);
- for (i = 0; i < 20; i++)
- LOG_PRINT(" %s: %d", RQ_TYPE(i), request_array[i]);
- LOG_PRINT("Cluster-bound requests:");
- for (i = 0; i < 20; i++)
- LOG_PRINT(" %s: %d", RQ_TYPE(i), cluster_array[i]);
- }
EXIT();
return r;
}
@@ -303,9 +298,6 @@

ENTER();

- memset(request_array, 0, sizeof(int)*20);
- memset(cluster_array, 0, sizeof(int)*20);
-
cn_fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
if (cn_fd < 0) {
EXIT();
--- cluster/cmirror/src/Attic/logging.h 2008/01/18 17:11:07 1.1.2.4
+++ cluster/cmirror/src/Attic/logging.h 2008/02/04 18:27:20 1.1.2.5
@@ -29,7 +29,7 @@
#endif

/* SHORT_UUID - print last 8 chars of a string */
-#define SHORT_UUID(x) ((x) + (strlen(x) - 8))
+#define SHORT_UUID(x) (strlen(x) > 8) ? ((x) + (strlen(x) - 8)) : (x)

extern int log_tabbing;
extern int log_is_open;
 

Thread Tools




All times are GMT. The time now is 12:30 AM.

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