public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* RHEL5 - dm-log-clustered/clogd: Fix off-by-one error and compilation errors
@ 2008-09-22  9:16 Jonathan Brassow
  0 siblings, 0 replies; only message in thread
From: Jonathan Brassow @ 2008-09-22  9:16 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=85d1423ec47e48ab844088ebaf4157327b928ae9
Commit:        85d1423ec47e48ab844088ebaf4157327b928ae9
Parent:        3d4256ce298e36bf245af16f0011773b670d8e6a
Author:        Jonathan Brassow <jbrassow@redhat.com>
AuthorDate:    Fri Sep 19 16:19:02 2008 -0500
Committer:     Jonathan Brassow <jbrassow@redhat.com>
CommitterDate: Fri Sep 19 16:19:43 2008 -0500

dm-log-clustered/clogd: Fix off-by-one error and compilation errors

Needed to tweek included header files to make dm-log-clustered compile
again.

Found an off-by-one error that was causing mirror corruption in the
case where the primary mirror device was killed in a mirror.
---
 cmirror-kernel/src/dm-clog-tfr.c |    2 +-
 cmirror-kernel/src/dm-clog.c     |    7 ++++---
 cmirror/src/functions.c          |   12 +++++++++---
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/cmirror-kernel/src/dm-clog-tfr.c b/cmirror-kernel/src/dm-clog-tfr.c
index 7bd30fa..15d971c 100644
--- a/cmirror-kernel/src/dm-clog-tfr.c
+++ b/cmirror-kernel/src/dm-clog-tfr.c
@@ -9,7 +9,7 @@
 #include <net/sock.h>
 #include <linux/workqueue.h>
 #include <linux/connector.h>
-#include "dm.h"
+#include <linux/device-mapper.h>
 #include "dm-clog-tfr.h"
 
 #include <asm/div64.h> /* Unnecessary */
diff --git a/cmirror-kernel/src/dm-clog.c b/cmirror-kernel/src/dm-clog.c
index fe14894..1e2b80e 100644
--- a/cmirror-kernel/src/dm-clog.c
+++ b/cmirror-kernel/src/dm-clog.c
@@ -4,10 +4,11 @@
  * This file is released under the LGPL.
  */
 
+#include <linux/blkdev.h> /* for sector_div, which is used in dm-dirty-log.h */
 #include <linux/bio.h>
 #include <linux/dm-dirty-log.h>
+#include <linux/device-mapper.h>
 
-#include "dm.h"
 #include "dm-clog-tfr.h"
 
 struct flush_entry {
@@ -658,7 +659,7 @@ static int cluster_is_remote_recovering(struct dm_dirty_log *log, region_t regio
 	int r;
 	struct log_c *lc = (struct log_c *)log->context;
 	static unsigned long long limit = 0;
-	struct { int is_recovering; uint64_t sync_search; } pkg;
+	struct { int is_recovering; uint64_t in_sync_hint; } pkg;
 	int rdata_size = sizeof(pkg);
 
 	/*
@@ -680,7 +681,7 @@ static int cluster_is_remote_recovering(struct dm_dirty_log *log, region_t regio
 	if (r)
 		return 1;
 
-	lc->in_sync_hint = pkg.sync_search;
+	lc->in_sync_hint = pkg.in_sync_hint;
 
 	return pkg.is_recovering;
 }
diff --git a/cmirror/src/functions.c b/cmirror/src/functions.c
index a086a72..6921bc0 100644
--- a/cmirror/src/functions.c
+++ b/cmirror/src/functions.c
@@ -1356,7 +1356,7 @@ static int clog_status_table(struct clog_tfr *tfr)
 static int clog_is_remote_recovering(struct clog_tfr *tfr)
 {
 	uint64_t region = *((uint64_t *)(tfr->data));
-	struct { int is_recovering; uint64_t sync_search; } *pkg = (void *)tfr->data;
+	struct { int is_recovering; uint64_t in_sync_hint; } *pkg = (void *)tfr->data;
 	struct log_c *lc = get_log(tfr->uuid);
 
 	if (!lc)
@@ -1369,10 +1369,16 @@ static int clog_is_remote_recovering(struct clog_tfr *tfr)
 		LOG_DBG("[%s] Recovery halted... [not remote recovering]: %llu",
 			SHORT_UUID(lc->uuid), (unsigned long long)region);
 		pkg->is_recovering = 0;
-		pkg->sync_search = lc->region_count; /* none are recovering */
+		pkg->in_sync_hint = lc->region_count; /* none are recovering */
 	} else {
 		pkg->is_recovering = !log_test_bit(lc->sync_bits, region);
-		pkg->sync_search = lc->sync_search;
+
+		/*
+		 * Remember, 'lc->sync_search' is 1 plus the region
+		 * currently being recovered.  So, we must take off 1
+		 * to account for that.
+		 */
+		pkg->in_sync_hint = (lc->sync_search - 1);
 		LOG_DBG("[%s] Region is %s: %llu",
 			SHORT_UUID(lc->uuid),
 			(region == lc->recovering_region) ?


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-19 21:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-22  9:16 RHEL5 - dm-log-clustered/clogd: Fix off-by-one error and compilation errors Jonathan Brassow

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 read-only IMAP folder(s) and NNTP newsgroup(s).