]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ocfs2_dlmfs: Enable the use of user cluster stacks.
authorJoel Becker <joel.becker@oracle.com>
Sat, 30 Jan 2010 14:02:10 +0000 (06:02 -0800)
committerJoel Becker <joel.becker@oracle.com>
Fri, 26 Feb 2010 23:41:18 +0000 (15:41 -0800)
Unlike ocfs2, dlmfs has no permanent storage.  It can't store off a
cluster stack it is supposed to be using.  So it can't specify the stack
name in ocfs2_cluster_connect().

Instead, we create ocfs2_cluster_connect_agnostic(), which simply uses
the stack that is currently enabled.  This is find for dlmfs, which will
rely on the stack initialization.

We add the "stackglue" capability to dlmfs's capability list.  This lets
userspace know dlmfs can be used with all cluster stacks.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
fs/ocfs2/dlmfs/dlmfs.c
fs/ocfs2/dlmfs/userdlm.c
fs/ocfs2/ocfs2_lockingver.h
fs/ocfs2/stackglue.c
fs/ocfs2/stackglue.h

index 8697366b63ad23418bd5cf0827c9055a272ad663..1b0de157a08c604aa8731c6f11291cbd97154af1 100644 (file)
@@ -87,7 +87,7 @@ struct workqueue_struct *user_dlm_worker;
  * - bast      : POLLIN against the file descriptor of a held lock
  *               signifies a bast fired on the lock.
  */
-#define DLMFS_CAPABILITIES "bast"
+#define DLMFS_CAPABILITIES "bast stackglue"
 extern int param_set_dlmfs_capabilities(const char *val,
                                        struct kernel_param *kp)
 {
index c1b6a56a268f2340a1b2d1bac65a544d925319a0..2858ee6003c7c6577b815332c89ae060e53bc4b4 100644 (file)
@@ -666,10 +666,10 @@ struct ocfs2_cluster_connection *user_dlm_register(struct qstr *name)
        int rc;
        struct ocfs2_cluster_connection *conn;
 
-       rc = ocfs2_cluster_connect("o2cb", name->name, name->len,
-                                  &user_dlm_lproto,
-                                  user_dlm_recovery_handler_noop,
-                                  NULL, &conn);
+       rc = ocfs2_cluster_connect_agnostic(name->name, name->len,
+                                           &user_dlm_lproto,
+                                           user_dlm_recovery_handler_noop,
+                                           NULL, &conn);
        if (rc)
                mlog_errno(rc);
 
index 82d5eeac0ffffdd398f8de2c5927a870c3c42b64..2e45c8d2ea7ef3ce05880d449589bb28625fe879 100644 (file)
@@ -23,6 +23,8 @@
 /*
  * The protocol version for ocfs2 cluster locking.  See dlmglue.c for
  * more details.
+ *
+ * 1.0 - Initial locking version from ocfs2 1.4.
  */
 #define OCFS2_LOCKING_PROTOCOL_MAJOR 1
 #define OCFS2_LOCKING_PROTOCOL_MINOR 0
index 31db2e87cfd42eab3f6b12e75e8edbf973693250..39abf89697edfc296173dce40a3e5aab1575202b 100644 (file)
@@ -373,6 +373,24 @@ out:
 }
 EXPORT_SYMBOL_GPL(ocfs2_cluster_connect);
 
+/* The caller will ensure all nodes have the same cluster stack */
+int ocfs2_cluster_connect_agnostic(const char *group,
+                                  int grouplen,
+                                  struct ocfs2_locking_protocol *lproto,
+                                  void (*recovery_handler)(int node_num,
+                                                           void *recovery_data),
+                                  void *recovery_data,
+                                  struct ocfs2_cluster_connection **conn)
+{
+       char *stack_name = NULL;
+
+       if (cluster_stack_name[0])
+               stack_name = cluster_stack_name;
+       return ocfs2_cluster_connect(stack_name, group, grouplen, lproto,
+                                    recovery_handler, recovery_data, conn);
+}
+EXPORT_SYMBOL_GPL(ocfs2_cluster_connect_agnostic);
+
 /* If hangup_pending is 0, the stack driver will be dropped */
 int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn,
                             int hangup_pending)
index b1981ba4c91f6b1db8c6400ee90e674c7d9071c2..8ce7398ae1d2dbac2041a7389ea41e4e8cd2acd3 100644 (file)
@@ -246,6 +246,17 @@ int ocfs2_cluster_connect(const char *stack_name,
                                                   void *recovery_data),
                          void *recovery_data,
                          struct ocfs2_cluster_connection **conn);
+/*
+ * Used by callers that don't store their stack name.  They must ensure
+ * all nodes have the same stack.
+ */
+int ocfs2_cluster_connect_agnostic(const char *group,
+                                  int grouplen,
+                                  struct ocfs2_locking_protocol *lproto,
+                                  void (*recovery_handler)(int node_num,
+                                                           void *recovery_data),
+                                  void *recovery_data,
+                                  struct ocfs2_cluster_connection **conn);
 int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn,
                             int hangup_pending);
 void ocfs2_cluster_hangup(const char *group, int grouplen);