]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ocfs2: pass ocfs2_cluster_connection to ocfs2_this_node
authorGoldwyn Rodrigues <rgoldwyn@suse.de>
Tue, 5 Nov 2013 05:55:10 +0000 (16:55 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 5 Nov 2013 05:55:10 +0000 (16:55 +1100)
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>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/dlmglue.c
fs/ocfs2/stack_o2cb.c
fs/ocfs2/stack_user.c
fs/ocfs2/stackglue.c
fs/ocfs2/stackglue.h

index 7c57de3882a47601d48412ec3c218abf3a2668a3..f2d48c8df77e123dbcb3202a77d8df62c3f9dd93 100644 (file)
@@ -3007,7 +3007,7 @@ int ocfs2_dlm_init(struct ocfs2_super *osb)
                goto bail;
        }
 
-       status = ocfs2_cluster_this_node(&osb->node_num);
+       status = ocfs2_cluster_this_node(conn, &osb->node_num);
        if (status < 0) {
                mlog_errno(status);
                mlog(ML_ERROR,
index bf1f8930456f145343089206ff3ec2469a532ad7..1724d43d3da1626b517b8deb73cd87c47492fd85 100644 (file)
@@ -398,7 +398,8 @@ static int o2cb_cluster_disconnect(struct ocfs2_cluster_connection *conn)
        return 0;
 }
 
-static int o2cb_cluster_this_node(unsigned int *node)
+static int o2cb_cluster_this_node(struct ocfs2_cluster_connection *conn,
+                                 unsigned int *node)
 {
        int node_num;
 
index 88259fb81d617fe1750b8f510ec1129b7442531f..5660e6dfc9ca2181cb81125c6aeaa08bbac1893f 100644 (file)
 #define OCFS2_CONTROL_MESSAGE_VERNUM_LEN       2
 #define OCFS2_CONTROL_MESSAGE_NODENUM_LEN      8
 
+enum ocfs2_connection_type {
+       WITH_CONTROLD,
+       NO_CONTROLD
+};
+
 /*
  * ocfs2_live_connection is refcounted because the filesystem and
  * miscdevice sides can detach in different order.  Let's just be safe.
 struct ocfs2_live_connection {
        struct list_head                oc_list;
        struct ocfs2_cluster_connection *oc_conn;
+       enum ocfs2_connection_type      oc_type;
        atomic_t                        oc_this_node;
        int                             oc_our_slot;
 };
@@ -840,6 +846,8 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
                goto out;
        }
 
+       lc->oc_type = WITH_CONTROLD;
+
        rc = ocfs2_live_connection_new(conn, lc);
        if (rc)
                goto out;
@@ -886,11 +894,16 @@ static int user_cluster_disconnect(struct ocfs2_cluster_connection *conn)
        return 0;
 }
 
-static int user_cluster_this_node(unsigned int *this_node)
+static int user_cluster_this_node(struct ocfs2_cluster_connection *conn,
+                                 unsigned int *this_node)
 {
        int rc;
+       struct ocfs2_live_connection *lc = conn->cc_private;
 
-       rc = ocfs2_control_get_this_node();
+       if (lc->oc_type == WITH_CONTROLD)
+               rc = ocfs2_control_get_this_node();
+       else
+               rc = -EINVAL;
        if (rc < 0)
                return rc;
 
index 58b53f9a4d833a64eae3ac7dacc408c136c6e010..ffece0471b1ed686bf2f9eb34f60bf863f8838c1 100644 (file)
@@ -465,9 +465,10 @@ void ocfs2_cluster_hangup(const char *group, int grouplen)
 }
 EXPORT_SYMBOL_GPL(ocfs2_cluster_hangup);
 
-int ocfs2_cluster_this_node(unsigned int *node)
+int ocfs2_cluster_this_node(struct ocfs2_cluster_connection *conn,
+                           unsigned int *node)
 {
-       return active_stack->sp_ops->this_node(node);
+       return active_stack->sp_ops->this_node(conn, node);
 }
 EXPORT_SYMBOL_GPL(ocfs2_cluster_this_node);
 
index b46fd51f2e423413e9a0f84d88902fffeaced752..d7bc4d0dcb3e2b8a85acc410a62463423068689a 100644 (file)
@@ -157,7 +157,8 @@ struct ocfs2_stack_operations {
         * ->this_node() returns the cluster's unique identifier for the
         * local node.
         */
-       int (*this_node)(unsigned int *node);
+       int (*this_node)(struct ocfs2_cluster_connection *conn,
+                        unsigned int *node);
 
        /*
         * Call the underlying dlm lock function.  The ->dlm_lock()
@@ -267,7 +268,8 @@ int ocfs2_cluster_connect_agnostic(const char *group,
 int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn,
                             int hangup_pending);
 void ocfs2_cluster_hangup(const char *group, int grouplen);
-int ocfs2_cluster_this_node(unsigned int *node);
+int ocfs2_cluster_this_node(struct ocfs2_cluster_connection *conn,
+                           unsigned int *node);
 
 struct ocfs2_lock_res;
 int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn,