Skip to content

Commit 3e83415

Browse files
Goldwyn Rodriguestorvalds
authored andcommitted
ocfs2: pass ocfs2_cluster_connection to ocfs2_this_node
This is done to differentiate between using and not using controld and use the connection information accordingly. We need to be backward compatible. So, we use a new enum ocfs2_connection_type to identify when controld is used and when it is not. 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>
1 parent 24aa338 commit 3e83415

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

fs/ocfs2/dlmglue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3007,7 +3007,7 @@ int ocfs2_dlm_init(struct ocfs2_super *osb)
30073007
goto bail;
30083008
}
30093009

3010-
status = ocfs2_cluster_this_node(&osb->node_num);
3010+
status = ocfs2_cluster_this_node(conn, &osb->node_num);
30113011
if (status < 0) {
30123012
mlog_errno(status);
30133013
mlog(ML_ERROR,

fs/ocfs2/stack_o2cb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ static int o2cb_cluster_disconnect(struct ocfs2_cluster_connection *conn)
398398
return 0;
399399
}
400400

401-
static int o2cb_cluster_this_node(unsigned int *node)
401+
static int o2cb_cluster_this_node(struct ocfs2_cluster_connection *conn,
402+
unsigned int *node)
402403
{
403404
int node_num;
404405

fs/ocfs2/stack_user.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,19 @@
103103
#define OCFS2_CONTROL_MESSAGE_VERNUM_LEN 2
104104
#define OCFS2_CONTROL_MESSAGE_NODENUM_LEN 8
105105

106+
enum ocfs2_connection_type {
107+
WITH_CONTROLD,
108+
NO_CONTROLD
109+
};
110+
106111
/*
107112
* ocfs2_live_connection is refcounted because the filesystem and
108113
* miscdevice sides can detach in different order. Let's just be safe.
109114
*/
110115
struct ocfs2_live_connection {
111116
struct list_head oc_list;
112117
struct ocfs2_cluster_connection *oc_conn;
118+
enum ocfs2_connection_type oc_type;
113119
atomic_t oc_this_node;
114120
int oc_our_slot;
115121
};
@@ -840,6 +846,7 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
840846
goto out;
841847
}
842848

849+
lc->oc_type = WITH_CONTROLD;
843850
rc = ocfs2_live_connection_attach(conn, lc);
844851
if (rc)
845852
goto out;
@@ -886,11 +893,16 @@ static int user_cluster_disconnect(struct ocfs2_cluster_connection *conn)
886893
return 0;
887894
}
888895

889-
static int user_cluster_this_node(unsigned int *this_node)
896+
static int user_cluster_this_node(struct ocfs2_cluster_connection *conn,
897+
unsigned int *this_node)
890898
{
891899
int rc;
900+
struct ocfs2_live_connection *lc = conn->cc_private;
892901

893-
rc = ocfs2_control_get_this_node();
902+
if (lc->oc_type == WITH_CONTROLD)
903+
rc = ocfs2_control_get_this_node();
904+
else
905+
rc = -EINVAL;
894906
if (rc < 0)
895907
return rc;
896908

fs/ocfs2/stackglue.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,10 @@ void ocfs2_cluster_hangup(const char *group, int grouplen)
465465
}
466466
EXPORT_SYMBOL_GPL(ocfs2_cluster_hangup);
467467

468-
int ocfs2_cluster_this_node(unsigned int *node)
468+
int ocfs2_cluster_this_node(struct ocfs2_cluster_connection *conn,
469+
unsigned int *node)
469470
{
470-
return active_stack->sp_ops->this_node(node);
471+
return active_stack->sp_ops->this_node(conn, node);
471472
}
472473
EXPORT_SYMBOL_GPL(ocfs2_cluster_this_node);
473474

fs/ocfs2/stackglue.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ struct ocfs2_stack_operations {
157157
* ->this_node() returns the cluster's unique identifier for the
158158
* local node.
159159
*/
160-
int (*this_node)(unsigned int *node);
160+
int (*this_node)(struct ocfs2_cluster_connection *conn,
161+
unsigned int *node);
161162

162163
/*
163164
* Call the underlying dlm lock function. The ->dlm_lock()
@@ -267,7 +268,8 @@ int ocfs2_cluster_connect_agnostic(const char *group,
267268
int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn,
268269
int hangup_pending);
269270
void ocfs2_cluster_hangup(const char *group, int grouplen);
270-
int ocfs2_cluster_this_node(unsigned int *node);
271+
int ocfs2_cluster_this_node(struct ocfs2_cluster_connection *conn,
272+
unsigned int *node);
271273

272274
struct ocfs2_lock_res;
273275
int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn,

0 commit comments

Comments
 (0)