dlm: delayed reply message warning
David Teigland
maintainerPATCH 2/4 dlm: delayed reply message warning
Add an option (disabled by default) to print a warning message when a lock has been waiting a configurable amount of time for a reply message from another node. This is mainly for debugging.
Signed-off-by David Teigland <[email protected]>
--- fs/dlm/config.c | 9 ++++- fs/dlm/config.h | 1 + fs/dlm/dlm_internal.h | 2 + fs/dlm/lock.c | 100 +++++++++++++++++++++++++++++++++++++++++++++--- fs/dlm/lock.h | 1 + fs/dlm/lockspace.c | 6 +- 6 files changed, 108 insertions(+), 11 deletions(-)
fs/dlm/config.c +8 -1
@@ -100,6 +100,7 @@ struct dlm_cluster {unsigned int cl_log_debug;unsigned int cl_protocol;unsigned int cl_timewarn_cs; +unsigned int cl_waitwarn_us; };enum {
@@ -114,6 +115,7 @@ enum {CLUSTER_ATTR_LOG_DEBUG ,CLUSTER_ATTR_PROTOCOL ,CLUSTER_ATTR_TIMEWARN_CS , + CLUSTER_ATTR_WAITWARN_US, }; struct cluster_attribute {
@@ -166,6 +168,7 @@ CLUSTER_ATTR(scan_secs, 1);CLUSTER_ATTR (log_debug,0 );CLUSTER_ATTR (protocol,0 );CLUSTER_ATTR (timewarn_cs,1 ); +CLUSTER_ATTR (waitwarn_us,0 );static struct configfs_attribute *cluster_attrs[] = { [CLUSTER_ATTR_TCP_PORT ] = &cluster_attr_tcp_port.attr,
@@ -179,6 +182,7 @@ static struct configfs_attribute *cluster_attrs[] = { [CLUSTER_ATTR_LOG_DEBUG] = &cluster_attr_log_debug.attr, [CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol.attr, [CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs.attr, + [CLUSTER_ATTR_WAITWARN_US ] = &cluster_attr_waitwarn_us.attr, NULL, };
@@ -439,6 +443,7 @@ static struct config_group *make_cluster(struct config_group *g, cl->cl_log_debug = dlm_config.ci_log_debug; cl->cl_protocol = dlm_config.ci_protocol; cl->cl_timewarn_cs = dlm_config.ci_timewarn_cs; + cl->cl_waitwarn_us = dlm_config.ci_waitwarn_us; space_list = &sps->ss_group; comm_list = &cms->cs_group;
@@ -986,6 +991,7 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num)#define DEFAULT_LOG_DEBUG 0#define DEFAULT_PROTOCOL 0#define DEFAULT_TIMEWARN_CS 500/* 5 sec = 500 centiseconds */ +#define DEFAULT_WAITWARN_US 0struct dlm_config_info dlm_config = { .ci_tcp_port =DEFAULT_TCP_PORT ,
@@ -998,6 +1004,7 @@ struct dlm_config_info dlm_config = { .ci_scan_secs = DEFAULT_SCAN_SECS, .ci_log_debug = DEFAULT_LOG_DEBUG, .ci_protocol = DEFAULT_PROTOCOL, - .ci_timewarn_cs = DEFAULT_TIMEWARN_CS + .ci_timewarn_cs = DEFAULT_TIMEWARN_CS, + .ci_waitwarn_us = DEFAULT_WAITWARN_US };
fs/dlm/config.h +1 -0
@@ -28,6 +28,7 @@ struct dlm_config_info {int ci_log_debug;int ci_protocol;int ci_timewarn_cs; +int ci_waitwarn_us; };extern struct dlm_config_info dlm_config;
fs/dlm/dlm_internal.h +2 -0
@@ -245,6 +245,7 @@ struct dlm_lkb {int8_t lkb_wait_type;/* type of reply waiting for */ int8_t lkb_wait_count; +int lkb_wait_nodeid;/* for debugging */ struct list_head lkb_idtbl_list;/* lockspace lkbtbl */ struct list_head lkb_statequeue;/* rsb g/c/w list */
@@ -254,6 +255,7 @@ struct dlm_lkb {struct list_head lkb_ownqueue;/* list of locks for a process */ struct list_head lkb_time_list;ktime_t lkb_timestamp; +ktime_t lkb_wait_time;unsigned long lkb_timeout_cs;struct dlm_callback lkb_callbacks[DLM_CALLBACKS_SIZE ];
fs/dlm/lock.c +93 -7
139 lines not on this page · raw message
fs/dlm/lock.h +1 -0
@@ -24,6 +24,7 @@ int dlm_put_lkb(struct dlm_lkb *lkb);void dlm_scan_rsbs (struct dlm_ls *ls);int dlm_lock_recovery_try (struct dlm_ls *ls);void dlm_unlock_recovery (struct dlm_ls *ls); +void dlm_scan_waiters (struct dlm_ls *ls);void dlm_scan_timeout (struct dlm_ls *ls);void dlm_adjust_timeouts (struct dlm_ls *ls);
fs/dlm/lockspace.c +3 -3
@@ -243,7 +243,6 @@ static struct dlm_ls *find_ls_to_scan(void)static int dlm_scand (void *data) {struct dlm_ls *ls; -int timeout_jiffies = dlm_config.ci_scan_secs *HZ ;while (!kthread_should_stop ()) { ls =find_ls_to_scan ();
@@ -252,13 +251,14 @@ static int dlm_scand(void *data) ls->ls_scan_time = jiffies;dlm_scan_rsbs (ls);dlm_scan_timeout (ls); +dlm_scan_waiters (ls);dlm_unlock_recovery (ls); }else { ls->ls_scan_time +=HZ ; } - }else { -schedule_timeout_interruptible (timeout_jiffies); +continue ; } +schedule_timeout_interruptible (dlm_config.ci_scan_secs *HZ ); }return 0 ; }
Signature · 1 line
1.7.1.1