Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /* -*- mode: c; c-basic-offset: 8; -*-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * vim: noexpandtab sw=8 ts=8 sts=0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * stack_o2cb.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Code which interfaces ocfs2 with the o2cb stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * Copyright (C) 2007 Oracle.  All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/crc32.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) /* Needed for AOP_TRUNCATED_PAGE in mlog_errno() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include "cluster/masklog.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include "cluster/nodemanager.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include "cluster/heartbeat.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include "cluster/tcp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include "stackglue.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) struct o2dlm_private {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	struct dlm_eviction_cb op_eviction_cb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) static struct ocfs2_stack_plugin o2cb_stack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) /* These should be identical */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #if (DLM_LOCK_IV != LKM_IVMODE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) # error Lock modes do not match
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #if (DLM_LOCK_NL != LKM_NLMODE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) # error Lock modes do not match
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #if (DLM_LOCK_CR != LKM_CRMODE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) # error Lock modes do not match
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #if (DLM_LOCK_CW != LKM_CWMODE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) # error Lock modes do not match
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #if (DLM_LOCK_PR != LKM_PRMODE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) # error Lock modes do not match
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #if (DLM_LOCK_PW != LKM_PWMODE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) # error Lock modes do not match
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #if (DLM_LOCK_EX != LKM_EXMODE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) # error Lock modes do not match
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) static inline int mode_to_o2dlm(int mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	BUG_ON(mode > LKM_MAXMODE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	return mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #define map_flag(_generic, _o2dlm)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	if (flags & (_generic)) {		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		flags &= ~(_generic);		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		o2dlm_flags |= (_o2dlm);	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) static int flags_to_o2dlm(u32 flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	int o2dlm_flags = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	map_flag(DLM_LKF_NOQUEUE, LKM_NOQUEUE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	map_flag(DLM_LKF_CANCEL, LKM_CANCEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	map_flag(DLM_LKF_CONVERT, LKM_CONVERT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	map_flag(DLM_LKF_VALBLK, LKM_VALBLK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	map_flag(DLM_LKF_IVVALBLK, LKM_INVVALBLK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	map_flag(DLM_LKF_ORPHAN, LKM_ORPHAN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	map_flag(DLM_LKF_FORCEUNLOCK, LKM_FORCE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	map_flag(DLM_LKF_TIMEOUT, LKM_TIMEOUT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	map_flag(DLM_LKF_LOCAL, LKM_LOCAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	/* map_flag() should have cleared every flag passed in */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	BUG_ON(flags != 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	return o2dlm_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #undef map_flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  * Map an o2dlm status to standard errno values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  * o2dlm only uses a handful of these, and returns even fewer to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  * caller. Still, we try to assign sane values to each error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  * The following value pairs have special meanings to dlmglue, thus
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)  * the right hand side needs to stay unique - never duplicate the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)  * mapping elsewhere in the table!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)  * DLM_NORMAL:		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)  * DLM_NOTQUEUED:	-EAGAIN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)  * DLM_CANCELGRANT:	-EBUSY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  * DLM_CANCEL:		-DLM_ECANCEL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) /* Keep in sync with dlmapi.h */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) static int status_map[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	[DLM_NORMAL]			= 0,		/* Success */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	[DLM_GRANTED]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	[DLM_DENIED]			= -EACCES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	[DLM_DENIED_NOLOCKS]		= -EACCES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	[DLM_WORKING]			= -EACCES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	[DLM_BLOCKED]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	[DLM_BLOCKED_ORPHAN]		= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	[DLM_DENIED_GRACE_PERIOD]	= -EACCES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	[DLM_SYSERR]			= -ENOMEM,	/* It is what it is */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	[DLM_NOSUPPORT]			= -EPROTO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	[DLM_CANCELGRANT]		= -EBUSY,	/* Cancel after grant */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	[DLM_IVLOCKID]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	[DLM_SYNC]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	[DLM_BADTYPE]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	[DLM_BADRESOURCE]		= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	[DLM_MAXHANDLES]		= -ENOMEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	[DLM_NOCLINFO]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	[DLM_NOLOCKMGR]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	[DLM_NOPURGED]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	[DLM_BADARGS]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	[DLM_VOID]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	[DLM_NOTQUEUED]			= -EAGAIN,	/* Trylock failed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	[DLM_IVBUFLEN]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	[DLM_CVTUNGRANT]		= -EPERM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	[DLM_BADPARAM]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	[DLM_VALNOTVALID]		= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	[DLM_REJECTED]			= -EPERM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	[DLM_ABORT]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	[DLM_CANCEL]			= -DLM_ECANCEL,	/* Successful cancel */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	[DLM_IVRESHANDLE]		= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	[DLM_DEADLOCK]			= -EDEADLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	[DLM_DENIED_NOASTS]		= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	[DLM_FORWARD]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	[DLM_TIMEOUT]			= -ETIMEDOUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	[DLM_IVGROUPID]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	[DLM_VERS_CONFLICT]		= -EOPNOTSUPP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	[DLM_BAD_DEVICE_PATH]		= -ENOENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	[DLM_NO_DEVICE_PERMISSION]	= -EPERM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	[DLM_NO_CONTROL_DEVICE]		= -ENOENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	[DLM_RECOVERING]		= -ENOTCONN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	[DLM_MIGRATING]			= -ERESTART,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	[DLM_MAXSTATS]			= -EINVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) static int dlm_status_to_errno(enum dlm_status status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	BUG_ON(status < 0 || status >= ARRAY_SIZE(status_map));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	return status_map[status];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) static void o2dlm_lock_ast_wrapper(void *astarg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	struct ocfs2_dlm_lksb *lksb = astarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	lksb->lksb_conn->cc_proto->lp_lock_ast(lksb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) static void o2dlm_blocking_ast_wrapper(void *astarg, int level)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	struct ocfs2_dlm_lksb *lksb = astarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	lksb->lksb_conn->cc_proto->lp_blocking_ast(lksb, level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	struct ocfs2_dlm_lksb *lksb = astarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	int error = dlm_status_to_errno(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	 * In o2dlm, you can get both the lock_ast() for the lock being
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	 * granted and the unlock_ast() for the CANCEL failing.  A
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	 * successful cancel sends DLM_NORMAL here.  If the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	 * lock grant happened before the cancel arrived, you get
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	 * DLM_CANCELGRANT.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	 * There's no need for the double-ast.  If we see DLM_CANCELGRANT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	 * we just ignore it.  We expect the lock_ast() to handle the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	 * granted lock.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	if (status == DLM_CANCELGRANT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	lksb->lksb_conn->cc_proto->lp_unlock_ast(lksb, error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 			 int mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 			 struct ocfs2_dlm_lksb *lksb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 			 u32 flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 			 void *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 			 unsigned int namelen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	enum dlm_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	int o2dlm_mode = mode_to_o2dlm(mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	int o2dlm_flags = flags_to_o2dlm(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	status = dlmlock(conn->cc_lockspace, o2dlm_mode, &lksb->lksb_o2dlm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 			 o2dlm_flags, name, namelen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 			 o2dlm_lock_ast_wrapper, lksb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 			 o2dlm_blocking_ast_wrapper);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	ret = dlm_status_to_errno(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) static int o2cb_dlm_unlock(struct ocfs2_cluster_connection *conn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 			   struct ocfs2_dlm_lksb *lksb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 			   u32 flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	enum dlm_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	int o2dlm_flags = flags_to_o2dlm(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	status = dlmunlock(conn->cc_lockspace, &lksb->lksb_o2dlm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 			   o2dlm_flags, o2dlm_unlock_ast_wrapper, lksb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	ret = dlm_status_to_errno(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) static int o2cb_dlm_lock_status(struct ocfs2_dlm_lksb *lksb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	return dlm_status_to_errno(lksb->lksb_o2dlm.status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  * o2dlm aways has a "valid" LVB. If the dlm loses track of the LVB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)  * contents, it will zero out the LVB.  Thus the caller can always trust
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)  * the contents.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) static int o2cb_dlm_lvb_valid(struct ocfs2_dlm_lksb *lksb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) static void *o2cb_dlm_lvb(struct ocfs2_dlm_lksb *lksb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	return (void *)(lksb->lksb_o2dlm.lvb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) static void o2cb_dump_lksb(struct ocfs2_dlm_lksb *lksb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	dlm_print_one_lock(lksb->lksb_o2dlm.lockid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)  * Check if this node is heartbeating and is connected to all other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)  * heartbeating nodes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) static int o2cb_cluster_check(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	u8 node_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	unsigned long hbmap[BITS_TO_LONGS(O2NM_MAX_NODES)];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	unsigned long netmap[BITS_TO_LONGS(O2NM_MAX_NODES)];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	node_num = o2nm_this_node();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	if (node_num == O2NM_MAX_NODES) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 		printk(KERN_ERR "o2cb: This node has not been configured.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	 * o2dlm expects o2net sockets to be created. If not, then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	 * dlm_join_domain() fails with a stack of errors which are both cryptic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	 * and incomplete. The idea here is to detect upfront whether we have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	 * managed to connect to all nodes or not. If not, then list the nodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	 * to allow the user to check the configuration (incorrect IP, firewall,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	 * etc.) Yes, this is racy. But its not the end of the world.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) #define	O2CB_MAP_STABILIZE_COUNT	60
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	for (i = 0; i < O2CB_MAP_STABILIZE_COUNT; ++i) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 		o2hb_fill_node_map(hbmap, sizeof(hbmap));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 		if (!test_bit(node_num, hbmap)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 			printk(KERN_ERR "o2cb: %s heartbeat has not been "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 			       "started.\n", (o2hb_global_heartbeat_active() ?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 					      "Global" : "Local"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 			return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 		o2net_fill_node_map(netmap, sizeof(netmap));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 		/* Force set the current node to allow easy compare */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 		set_bit(node_num, netmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 		if (!memcmp(hbmap, netmap, sizeof(hbmap)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 			return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 		if (i < O2CB_MAP_STABILIZE_COUNT - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 			msleep(1000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	printk(KERN_ERR "o2cb: This node could not connect to nodes:");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	i = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	while ((i = find_next_bit(hbmap, O2NM_MAX_NODES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 				  i + 1)) < O2NM_MAX_NODES) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 		if (!test_bit(i, netmap))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 			printk(" %u", i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	printk(".\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	return -ENOTCONN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)  * Called from the dlm when it's about to evict a node. This is how the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)  * classic stack signals node death.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) static void o2dlm_eviction_cb(int node_num, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	struct ocfs2_cluster_connection *conn = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	printk(KERN_NOTICE "o2cb: o2dlm has evicted node %d from domain %.*s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	       node_num, conn->cc_namelen, conn->cc_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	conn->cc_recovery_handler(node_num, conn->cc_recovery_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) static int o2cb_cluster_connect(struct ocfs2_cluster_connection *conn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	int rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 	u32 dlm_key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	struct dlm_ctxt *dlm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	struct o2dlm_private *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	struct dlm_protocol_version fs_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	BUG_ON(conn == NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 	BUG_ON(conn->cc_proto == NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	/* Ensure cluster stack is up and all nodes are connected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	rc = o2cb_cluster_check();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	if (rc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 		printk(KERN_ERR "o2cb: Cluster check failed. Fix errors "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 		       "before retrying.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	priv = kzalloc(sizeof(struct o2dlm_private), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	if (!priv) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 		rc = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 	/* This just fills the structure in.  It is safe to pass conn. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 	dlm_setup_eviction_cb(&priv->op_eviction_cb, o2dlm_eviction_cb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 			      conn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	conn->cc_private = priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	/* used by the dlm code to make message headers unique, each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	 * node in this domain must agree on this. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	dlm_key = crc32_le(0, conn->cc_name, conn->cc_namelen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 	fs_version.pv_major = conn->cc_version.pv_major;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 	fs_version.pv_minor = conn->cc_version.pv_minor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 	dlm = dlm_register_domain(conn->cc_name, dlm_key, &fs_version);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	if (IS_ERR(dlm)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 		rc = PTR_ERR(dlm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 		mlog_errno(rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 	conn->cc_version.pv_major = fs_version.pv_major;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 	conn->cc_version.pv_minor = fs_version.pv_minor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 	conn->cc_lockspace = dlm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	dlm_register_eviction_cb(dlm, &priv->op_eviction_cb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) out_free:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 	if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 		kfree(conn->cc_private);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) static int o2cb_cluster_disconnect(struct ocfs2_cluster_connection *conn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 	struct dlm_ctxt *dlm = conn->cc_lockspace;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	struct o2dlm_private *priv = conn->cc_private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	dlm_unregister_eviction_cb(&priv->op_eviction_cb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 	conn->cc_private = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	kfree(priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 	dlm_unregister_domain(dlm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	conn->cc_lockspace = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) static int o2cb_cluster_this_node(struct ocfs2_cluster_connection *conn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 				  unsigned int *node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 	int node_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 	node_num = o2nm_this_node();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 	if (node_num == O2NM_INVALID_NODE_NUM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 		return -ENOENT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	if (node_num >= O2NM_MAX_NODES)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 		return -EOVERFLOW;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 	*node = node_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) static struct ocfs2_stack_operations o2cb_stack_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	.connect	= o2cb_cluster_connect,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 	.disconnect	= o2cb_cluster_disconnect,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 	.this_node	= o2cb_cluster_this_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	.dlm_lock	= o2cb_dlm_lock,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	.dlm_unlock	= o2cb_dlm_unlock,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	.lock_status	= o2cb_dlm_lock_status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 	.lvb_valid	= o2cb_dlm_lvb_valid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	.lock_lvb	= o2cb_dlm_lvb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 	.dump_lksb	= o2cb_dump_lksb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) static struct ocfs2_stack_plugin o2cb_stack = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 	.sp_name	= "o2cb",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 	.sp_ops		= &o2cb_stack_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 	.sp_owner	= THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) static int __init o2cb_stack_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 	return ocfs2_stack_glue_register(&o2cb_stack);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) static void __exit o2cb_stack_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 	ocfs2_stack_glue_unregister(&o2cb_stack);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) MODULE_AUTHOR("Oracle");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) MODULE_DESCRIPTION("ocfs2 driver for the classic o2cb stack");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) module_init(o2cb_stack_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) module_exit(o2cb_stack_exit);