From: Alexander Aring <aahringo@redhat.com>
To: teigland@redhat.com
Cc: gfs2@lists.linux.dev, song@kernel.org, yukuai3@huawei.com,
agruenba@redhat.com, mark@fasheh.com, jlbec@evilplan.org,
joseph.qi@linux.alibaba.com, gregkh@linuxfoundation.org,
rafael@kernel.org, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org,
ocfs2-devel@lists.linux.dev, netdev@vger.kernel.org,
vvidic@valentin-vidic.from.hr, heming.zhao@suse.com,
lucien.xin@gmail.com, donald.hunter@gmail.com,
aahringo@redhat.com
Subject: [PATCHv2 dlm/next 03/12] dlm: add struct net to dlm_new_lockspace()
Date: Mon, 30 Sep 2024 16:13:49 -0400 [thread overview]
Message-ID: <20240930201358.2638665-4-aahringo@redhat.com> (raw)
In-Reply-To: <20240930201358.2638665-1-aahringo@redhat.com>
To prepare a namespace separation for each DLM lockspaces context we add
a struct net parameter that the user tells us in which net-namespace
the lockspace should be created. We are using net-namespace here because
a DLM lockspaces context acts like a per cluster node separation and the
created per node sockets need to be separated by their net-namespaces
anyway. It just fits that the DLM lockspaces are also separated by a per
"network entity".
This patch only prepares for such parameter for a functionality that
does not exist yet. It does not have any effect. If there will be
support for such handling the DLM user need to activate it anyway as the
applied parameter for now is the "&init_net" instance that is the
default namespace which we are currently using.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
drivers/md/md-cluster.c | 3 ++-
fs/dlm/lockspace.c | 5 +++--
fs/gfs2/lock_dlm.c | 6 +++---
fs/ocfs2/stack_user.c | 2 +-
include/linux/dlm.h | 9 +++++++--
5 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 6595f89becdb..a79c3833af96 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -897,7 +897,8 @@ static int join(struct mddev *mddev, int nodes)
memset(str, 0, 64);
sprintf(str, "%pU", mddev->uuid);
- ret = dlm_new_lockspace(str, mddev->bitmap_info.cluster_name,
+ ret = dlm_new_lockspace(&init_net, str,
+ mddev->bitmap_info.cluster_name,
DLM_LSFL_SOFTIRQ, LVB_SIZE, &md_ls_ops, mddev,
&ops_rv, &cinfo->lockspace);
if (ret)
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 00d37125bc44..2dd37a2e718d 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -663,8 +663,9 @@ static int __dlm_new_lockspace(const char *name, const char *cluster,
return error;
}
-int dlm_new_lockspace(const char *name, const char *cluster, uint32_t flags,
- int lvblen, const struct dlm_lockspace_ops *ops,
+int dlm_new_lockspace(struct net *net, const char *name, const char *cluster,
+ uint32_t flags, int lvblen,
+ const struct dlm_lockspace_ops *ops,
void *ops_arg, int *ops_result,
dlm_lockspace_t **lockspace)
{
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index fa5134df985f..6c5dce57a2ee 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -1328,9 +1328,9 @@ static int gdlm_mount(struct gfs2_sbd *sdp, const char *table)
* create/join lockspace
*/
- error = dlm_new_lockspace(fsname, cluster, flags, GDLM_LVB_SIZE,
- &gdlm_lockspace_ops, sdp, &ops_result,
- &ls->ls_dlm);
+ error = dlm_new_lockspace(&init_net, fsname, cluster, flags,
+ GDLM_LVB_SIZE, &gdlm_lockspace_ops, sdp,
+ &ops_result, &ls->ls_dlm);
if (error) {
fs_err(sdp, "dlm_new_lockspace error %d\n", error);
goto fail_free;
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
index 77edcd70f72c..23611eba58ef 100644
--- a/fs/ocfs2/stack_user.c
+++ b/fs/ocfs2/stack_user.c
@@ -984,7 +984,7 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
conn->cc_private = lc;
lc->oc_type = NO_CONTROLD;
- rc = dlm_new_lockspace(conn->cc_name, conn->cc_cluster_name,
+ rc = dlm_new_lockspace(&init_net, conn->cc_name, conn->cc_cluster_name,
DLM_LSFL_NEWEXCL, DLM_LVB_LEN,
&ocfs2_ls_ops, conn, &ops_rv, &fsdlm);
if (rc) {
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index bacda9898f2b..ecab5c197a7f 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -11,9 +11,9 @@
#ifndef __DLM_DOT_H__
#define __DLM_DOT_H__
+#include <net/net_namespace.h>
#include <uapi/linux/dlm.h>
-
struct dlm_slot {
int nodeid; /* 1 to MAX_INT */
int slot; /* 1 to MAX_INT */
@@ -43,6 +43,11 @@ struct dlm_lockspace_ops {
*
* Create/join a lockspace.
*
+ * net: the net namespace context pointer where the lockspace belongs to.
+ * DLM lockspaces can be separated according to net namespaces. As DLM
+ * requires networking communication this net namespace can be used to
+ * have a own DLM lockspace on each network entity e.g. a DLM node.
+ *
* name: lockspace name, null terminated, up to DLM_LOCKSPACE_LEN (not
* including terminating null).
*
@@ -82,7 +87,7 @@ struct dlm_lockspace_ops {
* lockspace: handle for dlm functions
*/
-int dlm_new_lockspace(const char *name, const char *cluster,
+int dlm_new_lockspace(struct net *net, const char *name, const char *cluster,
uint32_t flags, int lvblen,
const struct dlm_lockspace_ops *ops, void *ops_arg,
int *ops_result, dlm_lockspace_t **lockspace);
--
2.43.0
next prev parent reply other threads:[~2024-09-30 20:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 20:13 [PATCHv2 dlm/next 00/12] dlm: net-namespace functionality Alexander Aring
2024-09-30 20:13 ` [PATCHv2 dlm/next 01/12] dlm: introduce dlm_find_lockspace_name() Alexander Aring
2024-09-30 20:13 ` [PATCHv2 dlm/next 02/12] dlm: disallow different configs nodeid storages Alexander Aring
2024-09-30 20:13 ` Alexander Aring [this message]
2024-09-30 20:13 ` [PATCHv2 dlm/next 04/12] dlm: handle port as __be16 network byte order Alexander Aring
2024-09-30 20:13 ` [PATCHv2 dlm/next 05/12] dlm: use dlm_config as only cluster configuration Alexander Aring
2024-09-30 20:13 ` [PATCHv2 dlm/next 06/12] dlm: dlm_config_info config fields to unsigned int Alexander Aring
2024-09-30 20:13 ` [PATCHv2 dlm/next 07/12] dlm: rename config to configfs Alexander Aring
2024-09-30 20:13 ` [PATCHv2 dlm/next 08/12] kobject: add kset_type_create_and_add() helper Alexander Aring
2024-09-30 20:13 ` [PATCHv2 dlm/next 09/12] kobject: export generic helper ops Alexander Aring
2024-09-30 20:13 ` [PATCHv2 dlm/next 10/12] dlm: separate dlm lockspaces per net-namespace Alexander Aring
2024-10-11 6:19 ` kernel test robot
2024-09-30 20:13 ` [PATCHv2 dlm/next 11/12] dlm: add nldlm net-namespace aware UAPI Alexander Aring
2024-09-30 20:22 ` Alexander Aring
2024-09-30 20:13 ` [PATCHv2 dlm/next 12/12] gfs2: separate mount context by net-namespaces Alexander Aring
2024-09-30 20:39 ` [PATCHv2 dlm/next 00/12] dlm: net-namespace functionality John Stoffel
2024-10-01 0:09 ` Alexander Aring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240930201358.2638665-4-aahringo@redhat.com \
--to=aahringo@redhat.com \
--cc=agruenba@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=donald.hunter@gmail.com \
--cc=gfs2@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=heming.zhao@suse.com \
--cc=jlbec@evilplan.org \
--cc=joseph.qi@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=mark@fasheh.com \
--cc=netdev@vger.kernel.org \
--cc=ocfs2-devel@lists.linux.dev \
--cc=rafael@kernel.org \
--cc=song@kernel.org \
--cc=teigland@redhat.com \
--cc=vvidic@valentin-vidic.from.hr \
--cc=yukuai3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).