dlm: rework recovery control
PATCH 6/12 dlm: rework recovery control
Rework recovery control, simplifying the process significantly and removing a lot of code. This also makes it easier for different user-space infrastructures to drive the dlm.
Signed-off-by David Teigland <[email protected]>
drivers/dlm/ast.c +1 -1
@@ -61,7 +61,7 @@ static void process_asts(void) r = lkb->lkb_resource; ls = r->res_ls; -if (!test_bit (LSFL_LS_RUN , &ls->ls_flags)) +if (dlm_locking_stopped (ls))continue ;list_del (&lkb->lkb_astqueue);
drivers/dlm/dir.c +1 -1
@@ -270,7 +270,7 @@ int dlm_recover_directory(struct dlm_ls ; } -set_bit (LSFL_DIR_VALID , &ls->ls_flags); +dlm_set_recover_status (ls,DLM_RS_DIR ); error =0 ;log_debug (ls,"dlm_recover_directory %d entries" , count);
drivers/dlm/dlm_internal.h +32 -41
120 lines not on this page · raw message
drivers/dlm/lock.c +3 -3
@@ -800,7 +800,7 @@ void dlm_scan_rsbs(struct dlm_ls *ls) {int i; -if (!test_bit (LSFL_LS_RUN , &ls->ls_flags)) +if (dlm_locking_stopped (ls))return ;for (i =0 ; i < ls->ls_rsbtbl_size; i++) {
@@ -3086,7 +3086,7 @@ int dlm_receive_message(struct dlm_headerecovery operation is starting. */ while (1 ) { -if (!test_bit (LSFL_LS_RUN , &ls->ls_flags)) { +if (dlm_locking_stopped (ls)) {if (!recovery)dlm_add_requestqueue (ls, nodeid, hd); error = -EINTR ;
@@ -3293,7 +3293,7 @@ int dlm_recover_waiters_post(struct dlm_int error =0 , mstype;while (1 ) { -if (!test_bit (LSFL_LS_RUN , &ls->ls_flags)) { +if (dlm_locking_stopped (ls)) {log_debug (ls,"recover_waiters_post aborted" ); error = -EINTR ;break ;
drivers/dlm/lockspace.c +32 -46
130 lines not on this page · raw message
drivers/dlm/member.c +26 -99
192 lines not on this page · raw message
drivers/dlm/member.h +1 -6
@@ -13,15 +13,10 @@#ifndef __MEMBER_DOT_H__#define __MEMBER_DOT_H__ -int dlm_ls_terminate (struct dlm_ls *ls);int dlm_ls_stop (struct dlm_ls *ls); -int dlm_ls_start (struct dlm_ls *ls,int event_nr); -int dlm_ls_finish (struct dlm_ls *ls,int event_nr); - +int dlm_ls_start (struct dlm_ls *ls);void dlm_clear_members (struct dlm_ls *ls);void dlm_clear_members_gone (struct dlm_ls *ls); -void dlm_clear_members_finish (struct dlm_ls *ls,int finish_event); -int dlm_recover_members_first (struct dlm_ls *ls,struct dlm_recover *rv);int dlm_recover_members (struct dlm_ls *ls,struct dlm_recover *rv,int *neg_out);int dlm_is_removed (struct dlm_ls *ls,int nodeid);
drivers/dlm/member_sysfs.c +42 -125
202 lines not on this page · raw message
drivers/dlm/member_sysfs.h +1 -0
@@ -16,6 +16,7 @@int dlm_member_sysfs_init (void );void dlm_member_sysfs_exit (void );int dlm_kobject_setup (struct dlm_ls *ls); +int dlm_uevent (struct dlm_ls *ls,int in);#endif /* __MEMBER_SYSFS_DOT_H__ */
drivers/dlm/rcom.c +7 -29
@@ -84,31 +84,6 @@ static int check_config(struct dlm_ls *lreturn 0 ; } -static int make_status (struct dlm_ls *ls) -{ -int status =0 ; - -if (test_bit (LSFL_NODES_VALID , &ls->ls_flags)) - status |=NODES_VALID ; - -if (test_bit (LSFL_ALL_NODES_VALID , &ls->ls_flags)) - status |=NODES_ALL_VALID ; - -if (test_bit (LSFL_DIR_VALID , &ls->ls_flags)) - status |=DIR_VALID ; - -if (test_bit (LSFL_ALL_DIR_VALID , &ls->ls_flags)) - status |=DIR_ALL_VALID ; - -if (test_bit (LSFL_LOCKS_VALID , &ls->ls_flags)) - status |=LOCKS_VALID ; - -if (test_bit (LSFL_ALL_LOCKS_VALID , &ls->ls_flags)) - status |=LOCKS_ALL_VALID ; - -return status; -} -int dlm_rcom_status (struct dlm_ls *ls,int nodeid) {struct dlm_rcom *rc;
@@ -119,7 +94,7 @@ int dlm_rcom_status(struct dlm_ls *ls, iif (nodeid ==dlm_our_nodeid ()) { rc = (struct dlm_rcom *) ls->ls_recover_buf; - rc->rc_result =make_status (ls); + rc->rc_result =dlm_recover_status (ls); goto out; }
@@ -150,7 +125,7 @@ static void receive_rcom_status(struct d sizeof(struct rcom_config), &rc, &mh);if (error)return ; - rc->rc_result =make_status (ls); + rc->rc_result =dlm_recover_status (ls);make_config (ls, (struct rcom_config *) rc->rc_buf);send_rcom (ls, mh, rc);
@@ -197,6 +172,7 @@ static void receive_rcom_names(struct dlstruct dlm_mhandle *mh;int error, inlen, outlen;int nodeid = rc_in->rc_header.h_nodeid; +uint32_t status =dlm_recover_status (ls);/* * We can't run dlm_dir_rebuild_send (which uses ls_nodes) while
@@ -205,7 +181,7 @@ static void receive_rcom_names(struct dl* message from a previous instance of recovery. */ -if (!test_bit (LSFL_NODES_VALID , &ls->ls_flags)) { +if (!(status &DLM_RS_NODES )) {log_debug (ls,"ignoring RCOM_NAMES from %u" , nodeid);return ; }
@@ -355,7 +331,9 @@ static void receive_rcom_lock(struct dlmstatic void receive_rcom_lock_reply (struct dlm_ls *ls,struct dlm_rcom *rc_in) { -if (!test_bit (LSFL_DIR_VALID , &ls->ls_flags)) { +uint32_t status =dlm_recover_status (ls); + +if (!(status &DLM_RS_DIR )) {log_debug (ls,"ignoring RCOM_LOCK_REPLY from %u" , rc_in->rc_header.h_nodeid);return ;
drivers/dlm/recover.c +45 -40
135 lines not on this page · raw message
drivers/dlm/recover.h +6 -4
@@ -14,8 +14,13 @@#ifndef __RECOVER_DOT_H__#define __RECOVER_DOT_H__ -int dlm_recovery_stopped (struct dlm_ls *ls);int dlm_wait_function (struct dlm_ls *ls,int (*testfn) (struct dlm_ls *ls)); +uint32_t dlm_recover_status (struct dlm_ls *ls); +void dlm_set_recover_status (struct dlm_ls *ls,uint32_t status); +int dlm_recover_members_wait (struct dlm_ls *ls); +int dlm_recover_directory_wait (struct dlm_ls *ls); +int dlm_recover_locks_wait (struct dlm_ls *ls); +int dlm_recover_done_wait (struct dlm_ls *ls);int dlm_recover_masters (struct dlm_ls *ls);int dlm_recover_master_reply (struct dlm_ls *ls,struct dlm_rcom *rc);int dlm_recover_locks (struct dlm_ls *ls);
@@ -24,9 +29,6 @@ int dlm_create_root_list(struct dlm_ls *void dlm_release_root_list (struct dlm_ls *ls);void dlm_clear_toss_list (struct dlm_ls *ls);void dlm_recover_rsbs (struct dlm_ls *ls); -int dlm_recover_members_wait (struct dlm_ls *ls); -int dlm_recover_directory_wait (struct dlm_ls *ls); -int dlm_recover_locks_wait (struct dlm_ls *ls);#endif /* __RECOVER_DOT_H__ */
drivers/dlm/recoverd.c +45 -476
567 lines not on this page · raw message
drivers/dlm/requestqueue.c +3 -3
@@ -79,8 +79,8 @@ int dlm_process_requestqueue(struct dlm_list_del (&e->list);kfree (e); -if (!test_bit (LSFL_LS_RUN , &ls->ls_flags)) { -log_debug (ls,"process_requestqueue abort ls_run" ); +if (dlm_locking_stopped (ls)) { +log_debug (ls,"process_requestqueue abort running" );up (&ls->ls_requestqueue_lock); error = -EINTR ;break ;
@@ -105,7 +105,7 @@ void dlm_wait_requestqueue(struct dlm_lsdown (&ls->ls_requestqueue_lock);if (list_empty (&ls->ls_requestqueue))break ; -if (!test_bit (LSFL_LS_RUN , &ls->ls_flags)) +if (dlm_locking_stopped (ls))break ;up (&ls->ls_requestqueue_lock);schedule ();
--