Skip to content

Commit cbe0e33

Browse files
author
Joel Becker
committed
ocfs2_dlmfs: Enable the use of user cluster stacks.
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>
1 parent 0016eed commit cbe0e33

5 files changed

Lines changed: 36 additions & 5 deletions

File tree

‎fs/ocfs2/dlmfs/dlmfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ struct workqueue_struct *user_dlm_worker;
8787
* - bast : POLLIN against the file descriptor of a held lock
8888
* signifies a bast fired on the lock.
8989
*/
90-
#define DLMFS_CAPABILITIES "bast"
90+
#define DLMFS_CAPABILITIES "bast stackglue"
9191
extern int param_set_dlmfs_capabilities(const char *val,
9292
struct kernel_param *kp)
9393
{

‎fs/ocfs2/dlmfs/userdlm.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,10 @@ struct ocfs2_cluster_connection *user_dlm_register(struct qstr *name)
666666
int rc;
667667
struct ocfs2_cluster_connection *conn;
668668

669-
rc = ocfs2_cluster_connect("o2cb", name->name, name->len,
670-
&user_dlm_lproto,
671-
user_dlm_recovery_handler_noop,
672-
NULL, &conn);
669+
rc = ocfs2_cluster_connect_agnostic(name->name, name->len,
670+
&user_dlm_lproto,
671+
user_dlm_recovery_handler_noop,
672+
NULL, &conn);
673673
if (rc)
674674
mlog_errno(rc);
675675

‎fs/ocfs2/ocfs2_lockingver.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
/*
2424
* The protocol version for ocfs2 cluster locking. See dlmglue.c for
2525
* more details.
26+
*
27+
* 1.0 - Initial locking version from ocfs2 1.4.
2628
*/
2729
#define OCFS2_LOCKING_PROTOCOL_MAJOR 1
2830
#define OCFS2_LOCKING_PROTOCOL_MINOR 0

‎fs/ocfs2/stackglue.c‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,24 @@ int ocfs2_cluster_connect(const char *stack_name,
373373
}
374374
EXPORT_SYMBOL_GPL(ocfs2_cluster_connect);
375375

376+
/* The caller will ensure all nodes have the same cluster stack */
377+
int ocfs2_cluster_connect_agnostic(const char *group,
378+
int grouplen,
379+
struct ocfs2_locking_protocol *lproto,
380+
void (*recovery_handler)(int node_num,
381+
void *recovery_data),
382+
void *recovery_data,
383+
struct ocfs2_cluster_connection **conn)
384+
{
385+
char *stack_name = NULL;
386+
387+
if (cluster_stack_name[0])
388+
stack_name = cluster_stack_name;
389+
return ocfs2_cluster_connect(stack_name, group, grouplen, lproto,
390+
recovery_handler, recovery_data, conn);
391+
}
392+
EXPORT_SYMBOL_GPL(ocfs2_cluster_connect_agnostic);
393+
376394
/* If hangup_pending is 0, the stack driver will be dropped */
377395
int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn,
378396
int hangup_pending)

‎fs/ocfs2/stackglue.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,17 @@ int ocfs2_cluster_connect(const char *stack_name,
246246
void *recovery_data),
247247
void *recovery_data,
248248
struct ocfs2_cluster_connection **conn);
249+
/*
250+
* Used by callers that don't store their stack name. They must ensure
251+
* all nodes have the same stack.
252+
*/
253+
int ocfs2_cluster_connect_agnostic(const char *group,
254+
int grouplen,
255+
struct ocfs2_locking_protocol *lproto,
256+
void (*recovery_handler)(int node_num,
257+
void *recovery_data),
258+
void *recovery_data,
259+
struct ocfs2_cluster_connection **conn);
249260
int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn,
250261
int hangup_pending);
251262
void ocfs2_cluster_hangup(const char *group, int grouplen);

0 commit comments

Comments
 (0)