aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.de>2014-01-21 18:48:21 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 19:19:41 -0500
commitc74a3bdd9b529d924d1abf986079b783dd105ace (patch)
tree5825198c12a9151ea403afae6b6822836b5f59b0 /fs
parentff8fb335221e2c446b0d4cbea26be371fd2feb64 (diff)
ocfs2: add clustername to cluster connection
This is an effort of removing ocfs2_controld.pcmk and getting ocfs2 DLM handling up to the times with respect to DLM (>=4.0.1) and corosync (2.3.x). AFAIK, cman also is being phased out for a unified corosync cluster stack. fs/dlm performs all the functions with respect to fencing and node management and provides the API's to do so for ocfs2. For all future references, DLM stands for fs/dlm code. The advantages are: + No need to run an additional userspace daemon (ocfs2_controld) + No controld device handling and controld protocol + Shifting responsibilities of node management to DLM layer For backward compatibility, we are keeping the controld handling code. Once enough time has passed we can remove a significant portion of the code. This was tested by using the kernel with changes on older unmodified tools. The kernel used ocfs2_controld as expected, and displayed the appropriate warning message. This feature requires modification in the userspace ocfs2-tools. The changes can be found at: https://github.com/goldwynr/ocfs2-tools branch: nocontrold Currently, not many checks are present in the userspace code, but that would change soon. This patch (of 6): Add clustername to cluster connection. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Reviewed-by: Mark Fasheh <mfasheh@suse.de> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/dlmglue.c2
-rw-r--r--fs/ocfs2/ocfs2.h1
-rw-r--r--fs/ocfs2/stackglue.c11
-rw-r--r--fs/ocfs2/stackglue.h9
-rw-r--r--fs/ocfs2/super.c8
5 files changed, 24 insertions, 7 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 3407b2c62b21..85852d62aa52 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -2996,6 +2996,8 @@ int ocfs2_dlm_init(struct ocfs2_super *osb)
2996 2996
2997 /* for now, uuid == domain */ 2997 /* for now, uuid == domain */
2998 status = ocfs2_cluster_connect(osb->osb_cluster_stack, 2998 status = ocfs2_cluster_connect(osb->osb_cluster_stack,
2999 osb->osb_cluster_name,
3000 strlen(osb->osb_cluster_name),
2999 osb->uuid_str, 3001 osb->uuid_str,
3000 strlen(osb->uuid_str), 3002 strlen(osb->uuid_str),
3001 &lproto, ocfs2_do_node_down, osb, 3003 &lproto, ocfs2_do_node_down, osb,
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 3a903470c794..553f53cc73ae 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -387,6 +387,7 @@ struct ocfs2_super
387 u8 osb_stackflags; 387 u8 osb_stackflags;
388 388
389 char osb_cluster_stack[OCFS2_STACK_LABEL_LEN + 1]; 389 char osb_cluster_stack[OCFS2_STACK_LABEL_LEN + 1];
390 char osb_cluster_name[OCFS2_CLUSTER_NAME_LEN + 1];
390 struct ocfs2_cluster_connection *cconn; 391 struct ocfs2_cluster_connection *cconn;
391 struct ocfs2_lock_res osb_super_lockres; 392 struct ocfs2_lock_res osb_super_lockres;
392 struct ocfs2_lock_res osb_rename_lockres; 393 struct ocfs2_lock_res osb_rename_lockres;
diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
index cb7ec0b63ddc..6537979b8ac4 100644
--- a/fs/ocfs2/stackglue.c
+++ b/fs/ocfs2/stackglue.c
@@ -309,6 +309,8 @@ int ocfs2_plock(struct ocfs2_cluster_connection *conn, u64 ino,
309EXPORT_SYMBOL_GPL(ocfs2_plock); 309EXPORT_SYMBOL_GPL(ocfs2_plock);
310 310
311int ocfs2_cluster_connect(const char *stack_name, 311int ocfs2_cluster_connect(const char *stack_name,
312 const char *cluster_name,
313 int cluster_name_len,
312 const char *group, 314 const char *group,
313 int grouplen, 315 int grouplen,
314 struct ocfs2_locking_protocol *lproto, 316 struct ocfs2_locking_protocol *lproto,
@@ -342,8 +344,10 @@ int ocfs2_cluster_connect(const char *stack_name,
342 goto out; 344 goto out;
343 } 345 }
344 346
345 memcpy(new_conn->cc_name, group, grouplen); 347 strlcpy(new_conn->cc_name, group, GROUP_NAME_MAX + 1);
346 new_conn->cc_namelen = grouplen; 348 new_conn->cc_namelen = grouplen;
349 strlcpy(new_conn->cc_cluster_name, cluster_name, CLUSTER_NAME_MAX + 1);
350 new_conn->cc_cluster_name_len = cluster_name_len;
347 new_conn->cc_recovery_handler = recovery_handler; 351 new_conn->cc_recovery_handler = recovery_handler;
348 new_conn->cc_recovery_data = recovery_data; 352 new_conn->cc_recovery_data = recovery_data;
349 353
@@ -386,8 +390,9 @@ int ocfs2_cluster_connect_agnostic(const char *group,
386 390
387 if (cluster_stack_name[0]) 391 if (cluster_stack_name[0])
388 stack_name = cluster_stack_name; 392 stack_name = cluster_stack_name;
389 return ocfs2_cluster_connect(stack_name, group, grouplen, lproto, 393 return ocfs2_cluster_connect(stack_name, NULL, 0, group, grouplen,
390 recovery_handler, recovery_data, conn); 394 lproto, recovery_handler, recovery_data,
395 conn);
391} 396}
392EXPORT_SYMBOL_GPL(ocfs2_cluster_connect_agnostic); 397EXPORT_SYMBOL_GPL(ocfs2_cluster_connect_agnostic);
393 398
diff --git a/fs/ocfs2/stackglue.h b/fs/ocfs2/stackglue.h
index 1ec56fdb8d0d..6d90f4192c14 100644
--- a/fs/ocfs2/stackglue.h
+++ b/fs/ocfs2/stackglue.h
@@ -45,6 +45,9 @@ struct file_lock;
45 */ 45 */
46#define GROUP_NAME_MAX 64 46#define GROUP_NAME_MAX 64
47 47
48/* This shadows OCFS2_CLUSTER_NAME_LEN */
49#define CLUSTER_NAME_MAX 16
50
48 51
49/* 52/*
50 * ocfs2_protocol_version changes when ocfs2 does something different in 53 * ocfs2_protocol_version changes when ocfs2 does something different in
@@ -97,8 +100,10 @@ struct ocfs2_locking_protocol {
97 * locking compatibility. 100 * locking compatibility.
98 */ 101 */
99struct ocfs2_cluster_connection { 102struct ocfs2_cluster_connection {
100 char cc_name[GROUP_NAME_MAX]; 103 char cc_name[GROUP_NAME_MAX + 1];
101 int cc_namelen; 104 int cc_namelen;
105 char cc_cluster_name[CLUSTER_NAME_MAX + 1];
106 int cc_cluster_name_len;
102 struct ocfs2_protocol_version cc_version; 107 struct ocfs2_protocol_version cc_version;
103 struct ocfs2_locking_protocol *cc_proto; 108 struct ocfs2_locking_protocol *cc_proto;
104 void (*cc_recovery_handler)(int node_num, void *recovery_data); 109 void (*cc_recovery_handler)(int node_num, void *recovery_data);
@@ -239,6 +244,8 @@ struct ocfs2_stack_plugin {
239 244
240/* Used by the filesystem */ 245/* Used by the filesystem */
241int ocfs2_cluster_connect(const char *stack_name, 246int ocfs2_cluster_connect(const char *stack_name,
247 const char *cluster_name,
248 int cluster_name_len,
242 const char *group, 249 const char *group,
243 int grouplen, 250 int grouplen,
244 struct ocfs2_locking_protocol *lproto, 251 struct ocfs2_locking_protocol *lproto,
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index fcd595e5d2c7..5445d72eb8e5 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -2223,10 +2223,9 @@ static int ocfs2_initialize_super(struct super_block *sb,
2223 if (ocfs2_clusterinfo_valid(osb)) { 2223 if (ocfs2_clusterinfo_valid(osb)) {
2224 osb->osb_stackflags = 2224 osb->osb_stackflags =
2225 OCFS2_RAW_SB(di)->s_cluster_info.ci_stackflags; 2225 OCFS2_RAW_SB(di)->s_cluster_info.ci_stackflags;
2226 memcpy(osb->osb_cluster_stack, 2226 strlcpy(osb->osb_cluster_stack,
2227 OCFS2_RAW_SB(di)->s_cluster_info.ci_stack, 2227 OCFS2_RAW_SB(di)->s_cluster_info.ci_stack,
2228 OCFS2_STACK_LABEL_LEN); 2228 OCFS2_STACK_LABEL_LEN + 1);
2229 osb->osb_cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0';
2230 if (strlen(osb->osb_cluster_stack) != OCFS2_STACK_LABEL_LEN) { 2229 if (strlen(osb->osb_cluster_stack) != OCFS2_STACK_LABEL_LEN) {
2231 mlog(ML_ERROR, 2230 mlog(ML_ERROR,
2232 "couldn't mount because of an invalid " 2231 "couldn't mount because of an invalid "
@@ -2235,6 +2234,9 @@ static int ocfs2_initialize_super(struct super_block *sb,
2235 status = -EINVAL; 2234 status = -EINVAL;
2236 goto bail; 2235 goto bail;
2237 } 2236 }
2237 strlcpy(osb->osb_cluster_name,
2238 OCFS2_RAW_SB(di)->s_cluster_info.ci_cluster,
2239 OCFS2_CLUSTER_NAME_LEN + 1);
2238 } else { 2240 } else {
2239 /* The empty string is identical with classic tools that 2241 /* The empty string is identical with classic tools that
2240 * don't know about s_cluster_info. */ 2242 * don't know about s_cluster_info. */