All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH dlm/next 00/12] dlm: net-namespace functionality
@ 2024-08-19 18:37 Alexander Aring
  2024-08-19 18:37 ` [PATCH dlm/next 01/12] dlm: introduce dlm_find_lockspace_name() Alexander Aring
                   ` (11 more replies)
  0 siblings, 12 replies; 21+ messages in thread
From: Alexander Aring @ 2024-08-19 18:37 UTC (permalink / raw)
  To: teigland
  Cc: gfs2, song, yukuai3, agruenba, mark, jlbec, joseph.qi, gregkh,
	rafael, akpm, linux-kernel, linux-raid, ocfs2-devel, netdev,
	vvidic, heming.zhao, lucien.xin, aahringo

Hi,

this patch-series is huge but brings a lot of basic "fun" net-namespace
functionality to DLM. Currently you need a couple of Linux kernel
instances running in e.g. Virtual Machines. With this patch-series I
want to break out of this virtual machine world dealing with multiple
kernels need to boot them all individually, etc. Now you can use DLM in
only one Linux kernel instance and each "node" (previously represented
by a virtual machine) is separate by a net-namespace. Why
net-namespaces? It just fits to the DLM design for now, you need to have
them anyway because the internal DLM socket handling on a per node
basis. What we do additionally is to separate the DLM lockspaces (the
lockspace that is being registered) by net-namespaces as this represents
a "network entity" (node). There might be reasons to introduce a
complete new kind of namespaces (locking namespace?) but I don't want to
do this step now and as I said net-namespaces are required anyway for
the DLM sockets.

You need some new user space tooling as a new netlink net-namespace
aware UAPI is introduced (but can co-exist with configfs that operates
on init_net only). See [0] for more steps, there is a copr repo for the
new tooling and can be enabled by:

$ dnf copr enable aring/nldlm
$ dnf install nldlm

or compile it yourself.

Then there is currently a very simple script [1] to show a 3 nodes
cluster
using gfs2 on a multiple loop block devices on a shared loop block
device
image (sounds weird but I do something like that). There are currently
some user space synchronization issues that I solve by simple sleeps,
but
they are only user space problems.

To test it I recommend some virtual machine "but only one" and run the
[1] script. Afterwards you have in your executed net-namespace the 3
mountpoints /cluster/node1, /cluster/node2/ and /cluster/node3. Any vfs
operations on those mountpoints acts as a per node entity operation.

We can use it for testing, development and also scale testing to have a
large number of nodes joining a lockspace (which seems to be a problem
right now). Instead of running 1000 vms, we can run 1000 net-namespaces
in a more resource limited environment. For me it seems gfs2 can handle
several mounts and still separate the resource according their global
variables. Their data structures e.g. glock hash seems to have in their
key a separation for that (fsid?). However this is still an experimental
feature we might run into issues that requires more separation related
to net-namespaces. However basic testing seems to run just fine.

Limitations

I disable any functionality for the DLM character device that allow
plock handling or do DLM locking from user space. Just don't use any
plock locking in gfs2 for now. But basic vfs operations should work. You
can even sniff DLM traffic on the created "dlmsw" virtual bridge.

- Alex

[0] https://gitlab.com/netcoder/nldlm
[1] https://gitlab.com/netcoder/gfs2ns-examples/-/blob/main/three_nodes

changes since PATCH:
 - add comments for lib/kobject.c
 - add Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
   for kobject patches
 - add more people, netdev ml in cc

Alexander Aring (12):
  dlm: introduce dlm_find_lockspace_name()
  dlm: disallow different configs nodeid storages
  dlm: add struct net to dlm_new_lockspace()
  dlm: handle port as __be16 network byte order
  dlm: use dlm_config as only cluster configuration
  dlm: dlm_config_info config fields to unsigned int
  dlm: rename config to configfs
  kobject: add kset_type_create_and_add() helper
  kobject: export generic helper ops
  dlm: separate dlm lockspaces per net-namespace
  dlm: add nldlm net-namespace aware UAPI
  gfs2: separate mount context by net-namespaces

 drivers/md/md-cluster.c |    3 +-
 fs/dlm/Makefile         |    2 +
 fs/dlm/config.c         | 1291 +++++++++++++++----------------------
 fs/dlm/config.h         |  215 +++++--
 fs/dlm/configfs.c       |  882 ++++++++++++++++++++++++++
 fs/dlm/configfs.h       |   19 +
 fs/dlm/debug_fs.c       |   24 +-
 fs/dlm/dir.c            |    4 +-
 fs/dlm/dlm_internal.h   |   24 +-
 fs/dlm/lock.c           |   64 +-
 fs/dlm/lock.h           |    3 +-
 fs/dlm/lockspace.c      |  220 ++++---
 fs/dlm/lockspace.h      |   12 +-
 fs/dlm/lowcomms.c       |  525 ++++++++--------
 fs/dlm/lowcomms.h       |   29 +-
 fs/dlm/main.c           |    5 -
 fs/dlm/member.c         |   36 +-
 fs/dlm/midcomms.c       |  287 ++++-----
 fs/dlm/midcomms.h       |   31 +-
 fs/dlm/nldlm.c          | 1330 +++++++++++++++++++++++++++++++++++++++
 fs/dlm/nldlm.h          |  176 ++++++
 fs/dlm/plock.c          |    2 +-
 fs/dlm/rcom.c           |   16 +-
 fs/dlm/rcom.h           |    3 +-
 fs/dlm/recover.c        |   17 +-
 fs/dlm/user.c           |   63 +-
 fs/dlm/user.h           |    2 +-
 fs/gfs2/glock.c         |    8 +
 fs/gfs2/incore.h        |    2 +
 fs/gfs2/lock_dlm.c      |    6 +-
 fs/gfs2/ops_fstype.c    |    5 +
 fs/gfs2/sys.c           |   27 +-
 fs/ocfs2/stack_user.c   |    2 +-
 include/linux/dlm.h     |    9 +-
 include/linux/kobject.h |   10 +-
 lib/kobject.c           |   65 +-
 36 files changed, 3955 insertions(+), 1464 deletions(-)
 create mode 100644 fs/dlm/configfs.c
 create mode 100644 fs/dlm/configfs.h
 create mode 100644 fs/dlm/nldlm.c
 create mode 100644 fs/dlm/nldlm.h

-- 
2.43.0


^ permalink raw reply	[flat|nested] 21+ messages in thread
* Re: [PATCH dlm/next 11/12] dlm: add nldlm net-namespace aware UAPI
@ 2024-08-20 19:29 kernel test robot
  0 siblings, 0 replies; 21+ messages in thread
From: kernel test robot @ 2024-08-20 19:29 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20240819183742.2263895-12-aahringo@redhat.com>
References: <20240819183742.2263895-12-aahringo@redhat.com>
TO: Alexander Aring <aahringo@redhat.com>
TO: teigland@redhat.com
CC: gfs2@lists.linux.dev
CC: song@kernel.org
CC: yukuai3@huawei.com
CC: agruenba@redhat.com
CC: mark@fasheh.com
CC: jlbec@evilplan.org
CC: joseph.qi@linux.alibaba.com
CC: gregkh@linuxfoundation.org
CC: rafael@kernel.org
CC: akpm@linux-foundation.org
CC: linux-kernel@vger.kernel.org
CC: linux-raid@vger.kernel.org
CC: ocfs2-devel@lists.linux.dev
CC: netdev@vger.kernel.org
CC: vvidic@valentin-vidic.from.hr
CC: heming.zhao@suse.com
CC: lucien.xin@gmail.com
CC: aahringo@redhat.com

Hi Alexander,

kernel test robot noticed the following build warnings:

[auto build test WARNING on teigland-dlm/next]
[also build test WARNING on next-20240820]
[cannot apply to gfs2/for-next driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus linus/master v6.11-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Alexander-Aring/dlm-introduce-dlm_find_lockspace_name/20240820-024440
base:   https://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm.git next
patch link:    https://lore.kernel.org/r/20240819183742.2263895-12-aahringo%40redhat.com
patch subject: [PATCH dlm/next 11/12] dlm: add nldlm net-namespace aware UAPI
:::::: branch date: 25 hours ago
:::::: commit date: 25 hours ago
config: x86_64-randconfig-161-20240820 (https://download.01.org/0day-ci/archive/20240821/202408210355.7IoUxYtZ-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202408210355.7IoUxYtZ-lkp@intel.com/

smatch warnings:
fs/dlm/nldlm.c:202 nldlm_get_ls() error: uninitialized symbol 'ls'.

vim +/ls +202 fs/dlm/nldlm.c

9ef283f3b6bbf7 Alexander Aring 2024-08-19  181  
9ef283f3b6bbf7 Alexander Aring 2024-08-19  182  static int nldlm_get_ls(struct sk_buff *msg, struct genl_info *info)
9ef283f3b6bbf7 Alexander Aring 2024-08-19  183  {
9ef283f3b6bbf7 Alexander Aring 2024-08-19  184  	struct dlm_net *dn = dlm_pernet(sock_net(msg->sk));
9ef283f3b6bbf7 Alexander Aring 2024-08-19  185  	struct dlm_cfg_ls *ls, *ls_iter = NULL;
9ef283f3b6bbf7 Alexander Aring 2024-08-19  186  	char lsname[DLM_LOCKSPACE_LEN];
9ef283f3b6bbf7 Alexander Aring 2024-08-19  187  	struct sk_buff *skb;
9ef283f3b6bbf7 Alexander Aring 2024-08-19  188  	int rv;
9ef283f3b6bbf7 Alexander Aring 2024-08-19  189  
9ef283f3b6bbf7 Alexander Aring 2024-08-19  190  	rv = nldlm_parse_ls(info->attrs[NLDLM_ATTR_LS], lsname);
9ef283f3b6bbf7 Alexander Aring 2024-08-19  191  	if (rv < 0)
9ef283f3b6bbf7 Alexander Aring 2024-08-19  192  		return rv;
9ef283f3b6bbf7 Alexander Aring 2024-08-19  193  
9ef283f3b6bbf7 Alexander Aring 2024-08-19  194  	mutex_lock(&dn->cfg_lock);
9ef283f3b6bbf7 Alexander Aring 2024-08-19  195  	list_for_each_entry(ls_iter, &dn->lockspaces, list) {
9ef283f3b6bbf7 Alexander Aring 2024-08-19  196  		if (!strncmp(ls_iter->name, lsname, DLM_LOCKSPACE_LEN)) {
9ef283f3b6bbf7 Alexander Aring 2024-08-19  197  			ls = ls_iter;
9ef283f3b6bbf7 Alexander Aring 2024-08-19  198  			break;
9ef283f3b6bbf7 Alexander Aring 2024-08-19  199  		}
9ef283f3b6bbf7 Alexander Aring 2024-08-19  200  	}
9ef283f3b6bbf7 Alexander Aring 2024-08-19  201  
9ef283f3b6bbf7 Alexander Aring 2024-08-19 @202  	if (!ls) {
9ef283f3b6bbf7 Alexander Aring 2024-08-19  203  		rv = -ENOENT;
9ef283f3b6bbf7 Alexander Aring 2024-08-19  204  		goto err;
9ef283f3b6bbf7 Alexander Aring 2024-08-19  205  	}
9ef283f3b6bbf7 Alexander Aring 2024-08-19  206  
9ef283f3b6bbf7 Alexander Aring 2024-08-19  207  	skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
9ef283f3b6bbf7 Alexander Aring 2024-08-19  208  	if (!skb) {
9ef283f3b6bbf7 Alexander Aring 2024-08-19  209  		rv = -ENOMEM;
9ef283f3b6bbf7 Alexander Aring 2024-08-19  210  		goto err;
9ef283f3b6bbf7 Alexander Aring 2024-08-19  211  	}
9ef283f3b6bbf7 Alexander Aring 2024-08-19  212  
9ef283f3b6bbf7 Alexander Aring 2024-08-19  213  	rv = __nldlm_get_ls(skb, ls, info->snd_portid,
9ef283f3b6bbf7 Alexander Aring 2024-08-19  214  			    info->snd_seq, NULL, 0);
9ef283f3b6bbf7 Alexander Aring 2024-08-19  215  	if (rv < 0) {
9ef283f3b6bbf7 Alexander Aring 2024-08-19  216  		nlmsg_free(skb);
9ef283f3b6bbf7 Alexander Aring 2024-08-19  217  		goto err;
9ef283f3b6bbf7 Alexander Aring 2024-08-19  218  	}
9ef283f3b6bbf7 Alexander Aring 2024-08-19  219  
9ef283f3b6bbf7 Alexander Aring 2024-08-19  220  	rv = genlmsg_reply(skb, info);
9ef283f3b6bbf7 Alexander Aring 2024-08-19  221  
9ef283f3b6bbf7 Alexander Aring 2024-08-19  222  err:
9ef283f3b6bbf7 Alexander Aring 2024-08-19  223  	mutex_unlock(&dn->cfg_lock);
9ef283f3b6bbf7 Alexander Aring 2024-08-19  224  	return rv;
9ef283f3b6bbf7 Alexander Aring 2024-08-19  225  }
9ef283f3b6bbf7 Alexander Aring 2024-08-19  226  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-08-21 22:57 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-19 18:37 [PATCH dlm/next 00/12] dlm: net-namespace functionality Alexander Aring
2024-08-19 18:37 ` [PATCH dlm/next 01/12] dlm: introduce dlm_find_lockspace_name() Alexander Aring
2024-08-19 18:37 ` [PATCH dlm/next 02/12] dlm: disallow different configs nodeid storages Alexander Aring
2024-08-19 18:37 ` [PATCH dlm/next 03/12] dlm: add struct net to dlm_new_lockspace() Alexander Aring
2024-08-19 18:37 ` [PATCH dlm/next 04/12] dlm: handle port as __be16 network byte order Alexander Aring
2024-08-19 18:37 ` [PATCH dlm/next 05/12] dlm: use dlm_config as only cluster configuration Alexander Aring
2024-08-19 18:37 ` [PATCH dlm/next 06/12] dlm: dlm_config_info config fields to unsigned int Alexander Aring
2024-08-19 18:37 ` [PATCH dlm/next 07/12] dlm: rename config to configfs Alexander Aring
2024-08-19 18:37 ` [PATCH dlm/next 08/12] kobject: add kset_type_create_and_add() helper Alexander Aring
2024-08-19 18:37 ` [PATCH dlm/next 09/12] kobject: export generic helper ops Alexander Aring
2024-08-19 18:37 ` [PATCH dlm/next 10/12] dlm: separate dlm lockspaces per net-namespace Alexander Aring
2024-08-20 19:22   ` Dan Carpenter
2024-08-19 18:37 ` [PATCH dlm/next 11/12] dlm: add nldlm net-namespace aware UAPI Alexander Aring
2024-08-19 22:12   ` Jakub Kicinski
2024-08-21 13:13     ` Alexander Aring
2024-08-21 22:57       ` Jakub Kicinski
2024-08-20  7:40   ` kernel test robot
2024-08-19 18:37 ` [PATCH dlm/next 12/12] gfs2: separate mount context by net-namespaces Alexander Aring
2024-08-20 14:42   ` kernel test robot
2024-08-20 17:37   ` kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2024-08-20 19:29 [PATCH dlm/next 11/12] dlm: add nldlm net-namespace aware UAPI kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.