cluster/cmirror-kernel/src dm-cmirror-client.c ...
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4U4
Changes by: jbrassow at sourceware.org 2006-07-22 22:12:33
Modified files:
cmirror-kernel/src: dm-cmirror-client.c dm-cmirror-common.h
dm-cmirror-server.c
Log message:
Fix for bug:
199862 - Suspending cluster mirrors can cause indefinite hang And is part of a fix for:
199185 ??? 'lvconvert' fails to remove device-mapper devices ... 198555 ??? mirror log not getting cleared causes new mirror ... And is likely to fix:
199334 ??? cmirror removal attempt hangs and caused locking ... And will certainly help for:
199498
198821
194137
194125
199635
All of the above bugs will need to be reexamined when the packages are rebuilt.
This fix allows the log server to migrate to other nodes during suspension. This prevents the situation where the log server may have it's devices suspended when it recieves a request. Trying to fulfill a log request while devices are suspended will lead to an indefinite hang, because I/O will not complete until the devices are unsuspended.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror-kernel/src/dm-cmirror-client.c.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=1.1.2.19.2.2&r2=1.1.2.19.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror-kernel/src/dm-cmirror-common.h.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=1.1.2.7.2.1&r2=1.1.2.7.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror-kernel/src/dm-cmirror-server.c.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=1.1.2.9.2.4&r2=1.1.2.9.2.5
cmirror-kernel/src/Attic/dm-cmirror-client.c +36 -28
@@ -243,7 +243,7 @@ -static int run_election (struct log_c *lc){ +static int run_election (struct log_c *lc,uint32_t initial_server){int error=0 , len;struct sockaddr_in saddr_in;struct msghdr msg;
@@ -255,7 +255,7 @@ lr.lr_type =LRT_ELECTION ; lr.u.lr_starter = my_id; - lr.u.lr_coordinator = my_id; + lr.u.lr_coordinator = initial_server;memcpy (lr.lr_uuid, lc->uuid,MAX_NAME_LEN );memset (&saddr_in,0 ,sizeof (struct sockaddr_cl ));
@@ -420,7 +420,6 @@if (len <=0 ){/* ATTENTION -- what do we do with this ? */ -// DMWARN("Failed to recvmsg from clustered log server"); error = len; *retry =1 ; goto fail;
@@ -435,16 +434,11 @@ }if (lr->u.lr_int_rtn == -ENXIO ){ -DMWARN ("server tells us it no longer controls the log" ); lc->server_id =0xDEAD ; *retry =1 ; goto fail; } -if (lr->u.lr_int_rtn <0 ){ -DMWARN ("an error occured on the server while processing our request" ); - } -if (result) *result = lr->u.lr_region_rtn;
@@ -463,8 +457,9 @@ } if(lr) kfree(lr); -#ifdef DEBUG - DMWARN("Request (%s) to server failed :: %d", +#if 0 + DMINFO("My (%u) request (%s) to server (%u) failed :: %d", + my_id, (type == LRT_IS_CLEAN)? "LRT_IS_CLEAN": (type == LRT_IN_SYNC)? "LRT_IN_SYNC": (type == LRT_MARK_REGION)? "LRT_MARK_REGION":
@@ -475,7 +470,7 @@ (type ==LRT_MASTER_LEAVING )?"LRT_MASTER_LEAVING" : (type ==LRT_ELECTION )?"LRT_ELECTION" : (type ==LRT_SELECTION )?"LRT_SELECTION" :"UNKNOWN" , - error); + lc->server_id, error);#endif return error; }
@@ -495,9 +490,13 @@ do{ retry = 0; suspend_on(&suspend_client_queue, atomic_read(&suspend_client)); + if ((type == LRT_MASTER_LEAVING) && (lc->server_id == 0xDEAD)) { + /* Nothing to do */ + goto out; + } election: while(lc->server_id == 0xDEAD){ - run_election(lc); + run_election(lc, my_id); new_server = 1; }
@@ -539,7 +538,7 @@ spin_unlock(®ion_state_lock); goto out; } else { - DMWARN("Continuing request:: %s", + DMINFO("Continuing request:: %s", (type == LRT_IS_CLEAN)? "LRT_IS_C LEAN": (type == LRT_IN_SYNC)? "LRT_IN_SYNC": (type == LRT_MARK_REGION)? "LRT_MARK_REGION":
@@ -737,14 +736,14 @@struct log_c *lc = (struct log_c *) log->context;if (!list_empty (&clear_region_list)) -DMERR ("LEAVING WHILE REGION REQUESTS REMAIN." ); +DMINFO ("Leaving while clear region requests remain." );list_del_init (&lc->log_list);if (lc->server_id == my_id)consult_server (lc,0 ,LRT_MASTER_LEAVING ,NULL );sock_release (lc->client_sock); -if (lc->log_dev) +if (lc->log_dev)disk_dtr (log);else core_dtr (log);
@@ -755,15 +754,13 @@static int cluster_presuspend (struct dirty_log *log) { -struct log_c *lc = (struct log_c *) log->context; +return 0 ; +} -/* -atomic_set(&lc->suspended, 1); +static int cluster_postsuspend (struct dirty_log *log) +{ +struct log_c *lc = (struct log_c *) log->context; -if (lc->log_dev && lc->log_dev_failed) -complete(&lc->failure_completion); -else -*/ while (1 ) {spin_lock (®ion_state_lock);if (list_empty (&clear_region_list)) {
@@ -775,20 +772,31 @@/* Just an unnessesary call to clear out regions */ consult_server (lc,0 ,LRT_IN_SYNC ,NULL ); } +atomic_set (&lc->suspended,1 ); +if (lc->server_id == my_id) { +while (1 ) { +consult_server (lc,0 ,LRT_MASTER_LEAVING ,NULL ); +down (&consult_server_lock); +run_election (lc,0xDEAD ); +up (&consult_server_lock); +if (lc->server_id == my_id) { +set_current_state (TASK_INTERRUPTIBLE ); +schedule_timeout (HZ /4 ); + }else { +break ; + } + } + }return 0 ; } -static int cluster_postsuspend (struct dirty_log *log){ -return 0 ; -} -static int cluster_resume (struct dirty_log *log){struct log_c *lc = (struct log_c *) log->context; lc->sync_search =0 ;resume_server_requests (); -/* atomic_set(&lc->suspended, 0); */ +atomic_set (&lc->suspended,0 );return 0 ; }
@@ -1310,7 +1318,7 @@ .get_failure_response = cluster_get_failure_response, }; -#define CMIRROR_RELEASE_NAME "0.1.0" +#define CMIRROR_RELEASE_NAME "0.2.0"static int __init cluster_dirty_log_init (void ) {int r =0 ;
cmirror-kernel/src/Attic/dm-cmirror-common.h +4 -2
@@ -13,10 +13,12 @@sector_t sector;sector_t count; }; +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);/* from dm.h */ -#define DM_NAME "device-mapper" +#define DM_NAME "dm-cmirror" #define DMWARN(f, x...) printk(KERN_WARNING DM_NAME ": " f "\n" , ## x) #define DMERR(f, x...) printk(KERN_ERR DM_NAME ": " f "\n" , ## x) #define DMINFO(f, x...) printk(KERN_INFO DM_NAME ": " f "\n" , ## x)
@@ -110,8 +112,8 @@* Disk log fields */ int log_dev_failed; -/* atomic_t suspended; +/* struct completion failure_completion; */ struct dm_dev *log_dev;
cmirror-kernel/src/Attic/dm-cmirror-server.c +93 -37
213 lines not on this page · raw message