aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/dlm/config.c')
-rw-r--r--fs/dlm/config.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index 822abdcd1434..5069b2cb5a1f 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -90,6 +90,7 @@ struct cluster {
90 unsigned int cl_scan_secs; 90 unsigned int cl_scan_secs;
91 unsigned int cl_log_debug; 91 unsigned int cl_log_debug;
92 unsigned int cl_protocol; 92 unsigned int cl_protocol;
93 unsigned int cl_timewarn_cs;
93}; 94};
94 95
95enum { 96enum {
@@ -103,6 +104,7 @@ enum {
103 CLUSTER_ATTR_SCAN_SECS, 104 CLUSTER_ATTR_SCAN_SECS,
104 CLUSTER_ATTR_LOG_DEBUG, 105 CLUSTER_ATTR_LOG_DEBUG,
105 CLUSTER_ATTR_PROTOCOL, 106 CLUSTER_ATTR_PROTOCOL,
107 CLUSTER_ATTR_TIMEWARN_CS,
106}; 108};
107 109
108struct cluster_attribute { 110struct cluster_attribute {
@@ -162,6 +164,7 @@ CLUSTER_ATTR(toss_secs, 1);
162CLUSTER_ATTR(scan_secs, 1); 164CLUSTER_ATTR(scan_secs, 1);
163CLUSTER_ATTR(log_debug, 0); 165CLUSTER_ATTR(log_debug, 0);
164CLUSTER_ATTR(protocol, 0); 166CLUSTER_ATTR(protocol, 0);
167CLUSTER_ATTR(timewarn_cs, 1);
165 168
166static struct configfs_attribute *cluster_attrs[] = { 169static struct configfs_attribute *cluster_attrs[] = {
167 [CLUSTER_ATTR_TCP_PORT] = &cluster_attr_tcp_port.attr, 170 [CLUSTER_ATTR_TCP_PORT] = &cluster_attr_tcp_port.attr,
@@ -174,6 +177,7 @@ static struct configfs_attribute *cluster_attrs[] = {
174 [CLUSTER_ATTR_SCAN_SECS] = &cluster_attr_scan_secs.attr, 177 [CLUSTER_ATTR_SCAN_SECS] = &cluster_attr_scan_secs.attr,
175 [CLUSTER_ATTR_LOG_DEBUG] = &cluster_attr_log_debug.attr, 178 [CLUSTER_ATTR_LOG_DEBUG] = &cluster_attr_log_debug.attr,
176 [CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol.attr, 179 [CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol.attr,
180 [CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs.attr,
177 NULL, 181 NULL,
178}; 182};
179 183
@@ -429,6 +433,8 @@ static struct config_group *make_cluster(struct config_group *g,
429 cl->cl_toss_secs = dlm_config.ci_toss_secs; 433 cl->cl_toss_secs = dlm_config.ci_toss_secs;
430 cl->cl_scan_secs = dlm_config.ci_scan_secs; 434 cl->cl_scan_secs = dlm_config.ci_scan_secs;
431 cl->cl_log_debug = dlm_config.ci_log_debug; 435 cl->cl_log_debug = dlm_config.ci_log_debug;
436 cl->cl_protocol = dlm_config.ci_protocol;
437 cl->cl_timewarn_cs = dlm_config.ci_timewarn_cs;
432 438
433 space_list = &sps->ss_group; 439 space_list = &sps->ss_group;
434 comm_list = &cms->cs_group; 440 comm_list = &cms->cs_group;
@@ -748,9 +754,16 @@ static ssize_t node_weight_write(struct node *nd, const char *buf, size_t len)
748 754
749static struct space *get_space(char *name) 755static struct space *get_space(char *name)
750{ 756{
757 struct config_item *i;
758
751 if (!space_list) 759 if (!space_list)
752 return NULL; 760 return NULL;
753 return to_space(config_group_find_obj(space_list, name)); 761
762 down(&space_list->cg_subsys->su_sem);
763 i = config_group_find_obj(space_list, name);
764 up(&space_list->cg_subsys->su_sem);
765
766 return to_space(i);
754} 767}
755 768
756static void put_space(struct space *sp) 769static void put_space(struct space *sp)
@@ -776,20 +789,20 @@ static struct comm *get_comm(int nodeid, struct sockaddr_storage *addr)
776 if (cm->nodeid != nodeid) 789 if (cm->nodeid != nodeid)
777 continue; 790 continue;
778 found = 1; 791 found = 1;
792 config_item_get(i);
779 break; 793 break;
780 } else { 794 } else {
781 if (!cm->addr_count || 795 if (!cm->addr_count ||
782 memcmp(cm->addr[0], addr, sizeof(*addr))) 796 memcmp(cm->addr[0], addr, sizeof(*addr)))
783 continue; 797 continue;
784 found = 1; 798 found = 1;
799 config_item_get(i);
785 break; 800 break;
786 } 801 }
787 } 802 }
788 up(&clusters_root.subsys.su_sem); 803 up(&clusters_root.subsys.su_sem);
789 804
790 if (found) 805 if (!found)
791 config_item_get(i);
792 else
793 cm = NULL; 806 cm = NULL;
794 return cm; 807 return cm;
795} 808}
@@ -909,6 +922,7 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num)
909#define DEFAULT_SCAN_SECS 5 922#define DEFAULT_SCAN_SECS 5
910#define DEFAULT_LOG_DEBUG 0 923#define DEFAULT_LOG_DEBUG 0
911#define DEFAULT_PROTOCOL 0 924#define DEFAULT_PROTOCOL 0
925#define DEFAULT_TIMEWARN_CS 500 /* 5 sec = 500 centiseconds */
912 926
913struct dlm_config_info dlm_config = { 927struct dlm_config_info dlm_config = {
914 .ci_tcp_port = DEFAULT_TCP_PORT, 928 .ci_tcp_port = DEFAULT_TCP_PORT,
@@ -920,6 +934,7 @@ struct dlm_config_info dlm_config = {
920 .ci_toss_secs = DEFAULT_TOSS_SECS, 934 .ci_toss_secs = DEFAULT_TOSS_SECS,
921 .ci_scan_secs = DEFAULT_SCAN_SECS, 935 .ci_scan_secs = DEFAULT_SCAN_SECS,
922 .ci_log_debug = DEFAULT_LOG_DEBUG, 936 .ci_log_debug = DEFAULT_LOG_DEBUG,
923 .ci_protocol = DEFAULT_PROTOCOL 937 .ci_protocol = DEFAULT_PROTOCOL,
938 .ci_timewarn_cs = DEFAULT_TIMEWARN_CS
924}; 939};
925 940