[Cluster-devel] Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-18-g9d2d37e

jbrassow at sourceware.org jbrassow at sourceware.org
Thu Mar 20 16:05:31 UTC 2008


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=9d2d37ee3db933f01c8e5021d6d6a5897d5fe017

The branch, RHEL4 has been updated
       via  9d2d37ee3db933f01c8e5021d6d6a5897d5fe017 (commit)
       via  8c6094c0c5d457c9572ff386c5b53f075ce54f9c (commit)
      from  c118d0ce03910523ebd6cd533a410283640caf37 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9d2d37ee3db933f01c8e5021d6d6a5897d5fe017
Merge: 8c6094c0c5d457c9572ff386c5b53f075ce54f9c c118d0ce03910523ebd6cd533a410283640caf37
Author: Jonathan Brassow <jbrassow at redhat.com>
Date:   Thu Mar 20 10:55:12 2008 -0500

    Merge branch 'RHEL4' of ssh://jbrassow@sources.redhat.com/git/cluster into rhel4

commit 8c6094c0c5d457c9572ff386c5b53f075ce54f9c
Author: Jonathan Brassow <jbrassow at redhat.com>
Date:   Thu Mar 20 10:37:50 2008 -0500

    dm-cmirror.ko:  change a blocking I/O to async I/O
    
    Sometimes, the mirror subdevices get suspended before
    the log server suspends.  This can lead to the server issuing
    I/O requests on devices that are suspended.  If it waits for the
    I/O to complete, it could wait indefinitly.  Now there is a
    timeout in place for the I/O, which should prevent the server
    from getting stuck.

-----------------------------------------------------------------------

Summary of changes:
 cmirror-kernel/src/dm-cmirror-client.c |    1 +
 cmirror-kernel/src/dm-cmirror-common.h |    7 ++++
 cmirror-kernel/src/dm-cmirror-server.c |   53 +++++++++++++++++++++++++++-----
 3 files changed, 53 insertions(+), 8 deletions(-)

diff --git a/cmirror-kernel/src/dm-cmirror-client.c b/cmirror-kernel/src/dm-cmirror-client.c
index 425a000..c644c13 100644
--- a/cmirror-kernel/src/dm-cmirror-client.c
+++ b/cmirror-kernel/src/dm-cmirror-client.c
@@ -113,6 +113,7 @@ static int core_ctr(struct dirty_log *log, struct dm_target *ti,
 	lc->sync = sync;
 	lc->failure_response = failure_response;
 	strncpy(lc->uuid, argv[uuid], MAX_NAME_LEN);
+	init_completion(&lc->complete);
 
 	/*
 	 * Work out how many words we need to hold the bitset.
diff --git a/cmirror-kernel/src/dm-cmirror-common.h b/cmirror-kernel/src/dm-cmirror-common.h
index 588958c..e8d2144 100644
--- a/cmirror-kernel/src/dm-cmirror-common.h
+++ b/cmirror-kernel/src/dm-cmirror-common.h
@@ -17,6 +17,9 @@ int dm_io_get(unsigned int num_pages);
 void dm_io_put(unsigned int num_pages);
 int dm_io_sync_vm(unsigned int num_regions, struct io_region *where, int rw,
                   void *data, unsigned long *error_bits);
+int dm_io_async_vm(unsigned int num_regions, struct io_region *where, int rw,
+		   void *data, void (*fn)(unsigned long, void *),/*io_notify_fn fn,*/ void *context);
+
 /* from dm.h */
 #define DM_NAME "dm-cmirror"
 #define DMWARN(f, x...) printk(KERN_WARNING DM_NAME ": " f "\n" , ## x)
@@ -63,6 +66,7 @@ struct dm_dev {
 void dm_table_event(struct dm_table *t);
 /* end of dm.h */
 
+#define SHORT_UUID(x) (strlen(x) > 8) ? ((x) + (strlen(x) - 8)) : (x)
 /*
  * Magic for persistent mirrors: "MiRr"
  */
@@ -115,6 +119,9 @@ struct log_c {
 	/*
 	 * Disk log fields
 	 */
+	int log_error;
+	struct completion complete;
+
 	int log_dev_failed;
 	atomic_t suspended;
 	/*
diff --git a/cmirror-kernel/src/dm-cmirror-server.c b/cmirror-kernel/src/dm-cmirror-server.c
index f05f0bd..4252058 100644
--- a/cmirror-kernel/src/dm-cmirror-server.c
+++ b/cmirror-kernel/src/dm-cmirror-server.c
@@ -98,6 +98,46 @@ static void header_from_disk(struct log_header *core, struct log_header *disk)
 	memcpy(core->uuid, disk->uuid, MAX_NAME_LEN);
 }
 
+static void do_io_callback(unsigned long error, void *context)
+{
+	struct log_c *lc = context;
+
+	lc->log_error = (error) ? -EIO : 0;
+	complete(&lc->complete);
+}
+
+/*
+ * do_io
+ * @log
+ * @rw: read/write
+ * @header: header (if not, then bits)
+ *
+ * Returns: 0 on success, -EXXX on error
+ */
+static int do_io(struct log_c *log, int rw, int header)
+{
+	int r;
+
+	r = dm_io_async_vm(1,
+			   (header) ? &log->header_location : &log->bits_location,
+			   rw,
+			   (header) ? log->disk_header : log->clean_bits,
+			   do_io_callback, log);
+	if (r) {
+		DMERR("Error while submitting log I/O: %d", r);
+		return r;
+	}
+
+	r = wait_for_completion_timeout(&log->complete, 5 * HZ);
+	if (!r) {
+		DMERR("[%s] Timed out waiting for log I/O: %s of %s",
+		      SHORT_UUID(log->uuid), (rw == WRITE) ? "Write" : "Read",
+		      (header) ? "header" : "bits");
+		return -EDEADLK;
+	}
+	return log->log_error;
+}
+
 int read_header(struct log_c *log)
 {
 	int r;
@@ -109,8 +149,7 @@ int read_header(struct log_c *log)
 	if (atomic_read(&log->suspended))
 		return -EDEADLK;
 
-	r = dm_io_sync_vm(1, &log->header_location, READ,
-			  log->disk_header, &ebits);
+	r = do_io(log, READ, 1);
 	if (unlikely(r))
 		return r;
 
@@ -143,8 +182,8 @@ int write_header(struct log_c *log)
 		return -EDEADLK;
 
 	header_to_disk(&log->header, log->disk_header);
-	return dm_io_sync_vm(1, &log->header_location, WRITE,
-			     log->disk_header, &ebits);
+
+	return do_io(log, WRITE, 1);
 }
 
 /*----------------------------------------------------------------
@@ -188,8 +227,7 @@ static int read_bits(struct log_c *log)
 	if (atomic_read(&log->suspended))
 		return -EDEADLK;
 
-	r = dm_io_sync_vm(1, &log->bits_location, READ,
-			  log->clean_bits, &ebits);
+	r = do_io(log, READ, 0);
 
 	if (unlikely(r))
 		return r;
@@ -207,8 +245,7 @@ static int write_bits(struct log_c *log)
 	if (atomic_read(&log->suspended))
 		return -EDEADLK;
 
-	return dm_io_sync_vm(1, &log->bits_location, WRITE,
-			     log->clean_bits, &ebits);
+	return do_io(log, WRITE, 0);
 }
 
 static int count_bits32(uint32_t *addr, unsigned size)


hooks/post-receive
--
Cluster Project




More information about the Cluster-devel mailing list