Lines Matching +full:cluster +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0-only
18 #include "cluster/masklog.h"
19 #include "cluster/nodemanager.h"
20 #include "cluster/heartbeat.h"
21 #include "cluster/tcp.h"
53 static inline int mode_to_o2dlm(int mode) in mode_to_o2dlm() argument
55 BUG_ON(mode > LKM_MAXMODE); in mode_to_o2dlm()
57 return mode; in mode_to_o2dlm()
93 * the right hand side needs to stay unique - never duplicate the
97 * DLM_NOTQUEUED: -EAGAIN
98 * DLM_CANCELGRANT: -EBUSY
99 * DLM_CANCEL: -DLM_ECANCEL
104 [DLM_GRANTED] = -EINVAL,
105 [DLM_DENIED] = -EACCES,
106 [DLM_DENIED_NOLOCKS] = -EACCES,
107 [DLM_WORKING] = -EACCES,
108 [DLM_BLOCKED] = -EINVAL,
109 [DLM_BLOCKED_ORPHAN] = -EINVAL,
110 [DLM_DENIED_GRACE_PERIOD] = -EACCES,
111 [DLM_SYSERR] = -ENOMEM, /* It is what it is */
112 [DLM_NOSUPPORT] = -EPROTO,
113 [DLM_CANCELGRANT] = -EBUSY, /* Cancel after grant */
114 [DLM_IVLOCKID] = -EINVAL,
115 [DLM_SYNC] = -EINVAL,
116 [DLM_BADTYPE] = -EINVAL,
117 [DLM_BADRESOURCE] = -EINVAL,
118 [DLM_MAXHANDLES] = -ENOMEM,
119 [DLM_NOCLINFO] = -EINVAL,
120 [DLM_NOLOCKMGR] = -EINVAL,
121 [DLM_NOPURGED] = -EINVAL,
122 [DLM_BADARGS] = -EINVAL,
123 [DLM_VOID] = -EINVAL,
124 [DLM_NOTQUEUED] = -EAGAIN, /* Trylock failed */
125 [DLM_IVBUFLEN] = -EINVAL,
126 [DLM_CVTUNGRANT] = -EPERM,
127 [DLM_BADPARAM] = -EINVAL,
128 [DLM_VALNOTVALID] = -EINVAL,
129 [DLM_REJECTED] = -EPERM,
130 [DLM_ABORT] = -EINVAL,
131 [DLM_CANCEL] = -DLM_ECANCEL, /* Successful cancel */
132 [DLM_IVRESHANDLE] = -EINVAL,
133 [DLM_DEADLOCK] = -EDEADLK,
134 [DLM_DENIED_NOASTS] = -EINVAL,
135 [DLM_FORWARD] = -EINVAL,
136 [DLM_TIMEOUT] = -ETIMEDOUT,
137 [DLM_IVGROUPID] = -EINVAL,
138 [DLM_VERS_CONFLICT] = -EOPNOTSUPP,
139 [DLM_BAD_DEVICE_PATH] = -ENOENT,
140 [DLM_NO_DEVICE_PERMISSION] = -EPERM,
141 [DLM_NO_CONTROL_DEVICE] = -ENOENT,
142 [DLM_RECOVERING] = -ENOTCONN,
143 [DLM_MIGRATING] = -ERESTART,
144 [DLM_MAXSTATS] = -EINVAL,
158 lksb->lksb_conn->cc_proto->lp_lock_ast(lksb); in o2dlm_lock_ast_wrapper()
165 lksb->lksb_conn->cc_proto->lp_blocking_ast(lksb, level); in o2dlm_blocking_ast_wrapper()
180 * There's no need for the double-ast. If we see DLM_CANCELGRANT, in o2dlm_unlock_ast_wrapper()
187 lksb->lksb_conn->cc_proto->lp_unlock_ast(lksb, error); in o2dlm_unlock_ast_wrapper()
191 int mode, in o2cb_dlm_lock() argument
198 int o2dlm_mode = mode_to_o2dlm(mode); in o2cb_dlm_lock()
202 status = dlmlock(conn->cc_lockspace, o2dlm_mode, &lksb->lksb_o2dlm, in o2cb_dlm_lock()
218 status = dlmunlock(conn->cc_lockspace, &lksb->lksb_o2dlm, in o2cb_dlm_unlock()
226 return dlm_status_to_errno(lksb->lksb_o2dlm.status); in o2cb_dlm_lock_status()
241 return (void *)(lksb->lksb_o2dlm.lvb); in o2cb_dlm_lvb()
246 dlm_print_one_lock(lksb->lksb_o2dlm.lockid); in o2cb_dump_lksb()
263 return -EINVAL; in o2cb_cluster_check()
281 return -EINVAL; in o2cb_cluster_check()
288 if (i < O2CB_MAP_STABILIZE_COUNT - 1) in o2cb_cluster_check()
293 i = -1; in o2cb_cluster_check()
301 return -ENOTCONN; in o2cb_cluster_check()
313 node_num, conn->cc_namelen, conn->cc_name); in o2dlm_eviction_cb()
315 conn->cc_recovery_handler(node_num, conn->cc_recovery_data); in o2dlm_eviction_cb()
327 BUG_ON(conn->cc_proto == NULL); in o2cb_cluster_connect()
329 /* Ensure cluster stack is up and all nodes are connected */ in o2cb_cluster_connect()
332 printk(KERN_ERR "o2cb: Cluster check failed. Fix errors " in o2cb_cluster_connect()
339 rc = -ENOMEM; in o2cb_cluster_connect()
344 dlm_setup_eviction_cb(&priv->op_eviction_cb, o2dlm_eviction_cb, in o2cb_cluster_connect()
347 conn->cc_private = priv; in o2cb_cluster_connect()
351 dlm_key = crc32_le(0, conn->cc_name, conn->cc_namelen); in o2cb_cluster_connect()
352 fs_version.pv_major = conn->cc_version.pv_major; in o2cb_cluster_connect()
353 fs_version.pv_minor = conn->cc_version.pv_minor; in o2cb_cluster_connect()
355 dlm = dlm_register_domain(conn->cc_name, dlm_key, &fs_version); in o2cb_cluster_connect()
362 conn->cc_version.pv_major = fs_version.pv_major; in o2cb_cluster_connect()
363 conn->cc_version.pv_minor = fs_version.pv_minor; in o2cb_cluster_connect()
364 conn->cc_lockspace = dlm; in o2cb_cluster_connect()
366 dlm_register_eviction_cb(dlm, &priv->op_eviction_cb); in o2cb_cluster_connect()
370 kfree(conn->cc_private); in o2cb_cluster_connect()
378 struct dlm_ctxt *dlm = conn->cc_lockspace; in o2cb_cluster_disconnect()
379 struct o2dlm_private *priv = conn->cc_private; in o2cb_cluster_disconnect()
381 dlm_unregister_eviction_cb(&priv->op_eviction_cb); in o2cb_cluster_disconnect()
382 conn->cc_private = NULL; in o2cb_cluster_disconnect()
386 conn->cc_lockspace = NULL; in o2cb_cluster_disconnect()
398 return -ENOENT; in o2cb_cluster_this_node()
401 return -EOVERFLOW; in o2cb_cluster_this_node()