Skip to contentSkip to conversation

dm: netlink

PATCH In review Alasdair G Kergon 8 participants 13 messages Jul 11, 2007 – Jul 13, 2007

Subsystems (4)
lore
Share & tools
lore

Alasdair G Kergon

author maintainer
#0 lore raw

PATCH 13/18 dm: netlink

From: Mike Anderson <[email protected]>

This patch adds a dm-netlink skeleton support to the Makefile, and the dm directory.

---

 drivers/md/Kconfig      |    5 ++
 drivers/md/Makefile     |    4 +
 drivers/md/dm-netlink.c |  103 ++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/md/dm-netlink.h |   50 +++++++++++++++++++++++
 drivers/md/dm.c         |    3 +
 include/linux/netlink.h |    2 
 6 files changed, 166 insertions(+), 1 deletion(-)
drivers/md/Kconfig +5 -0
Index: linux/drivers/md/Kconfig
===================================================================
@@ -271,6 +271,11 @@ config DM_DELAY
 
 	If unsure, say N.
 
+config DM_NETLINK
+	bool "DM netlink events (EXPERIMENTAL)"
+	depends on BLK_DEV_DM && EXPERIMENTAL
+	---help---
+	Generate netlink events for DM events.
 endmenu
 
 endif
drivers/md/Makefile +4 -0
Index: linux/drivers/md/Makefile
===================================================================
@@ -46,6 +46,10 @@ ifeq ($(CONFIG_ALTIVEC),y)
 altivec_flags := -maltivec -mabi=altivec
 endif
 
+ifeq ($(CONFIG_DM_NETLINK),y)
+dm-mod-objs			+= dm-netlink.o
+endif
+
 targets += raid6int1.c
 $(obj)/raid6int1.c:   UNROLL := 1
 $(obj)/raid6int1.c:   $(src)/raid6int.uc $(src)/unroll.pl FORCE
drivers/md/dm-netlink.c new file +103 -0

103 lines not on this page · raw message

drivers/md/dm-netlink.h new file +50 -0

50 lines not on this page · raw message

drivers/md/dm.c +3 -0
Index: linux/drivers/md/dm.c
===================================================================
@@ -7,6 +7,7 @@
 
 #include "dm.h"
 #include "dm-bio-list.h"
+#include "dm-netlink.h"
 
 #include <linux/init.h>
 #include <linux/module.h>
@@ -176,6 +177,7 @@ int (*_inits[])(void) __initdata = {
 	dm_linear_init,
 	dm_stripe_init,
 	dm_interface_init,
+	dm_netlink_init,
 };
 
 void (*_exits[])(void) = {
@@ -184,6 +186,7 @@ void (*_exits[])(void) = {
 	dm_linear_exit,
 	dm_stripe_exit,
 	dm_interface_exit,
+	dm_netlink_exit,
 };
 
 static int __init dm_init(void)
include/linux/netlink.h +1 -1
Index: linux/include/linux/netlink.h
===================================================================
@@ -21,7 +21,7 @@
 #define NETLINK_DNRTMSG		14	/* DECnet routing messages */
 #define NETLINK_KOBJECT_UEVENT	15	/* Kernel messages to userspace */
 #define NETLINK_GENERIC		16
-/* leave room for NETLINK_DM (DM Events) */
+#define NETLINK_DM		17	/* Device Mapper */
 #define NETLINK_SCSITRANSPORT	18	/* SCSI Transports */
 #define NETLINK_ECRYPTFS	19
 
#1 lore raw

drivers/md/Kconfig config DM_DELAY · line 278

Quoted 12 lines · On Wed, 11 Jul 2007 22:01:37 +0100 Alasdair G Kergon <[email protected]> wrote:

From: Mike Anderson <[email protected]>

This patch adds a dm-netlink skeleton support to the Makefile, and the dm directory.

...

drivers/md/Kconfig +5 -0
+config DM_NETLINK
+	bool "DM netlink events (EXPERIMENTAL)"
+	depends on BLK_DEV_DM && EXPERIMENTAL
+	---help---
+	Generate netlink events for DM events.

Need a dependency on NET there?

drivers/md/dm-netlink.h line 40

Quoted 10 lines

...

drivers/md/dm-netlink.h new file +8 -0
+#ifdef CONFIG_DM_NETLINK
+
+int dm_netlink_init(void);
+void dm_netlink_exit(void);
+
+#else	/* CONFIG_DM_NETLINK */
+
+static inline int __init dm_netlink_init(void)

The __init here isn't needed (doesn't make sense, is missing the required #include anyway)

Quoted 31 lines
drivers/md/dm-netlink.h new file +10 -0
+{
+	return 0;
+}
+static inline void dm_netlink_exit(void)
+{
+}
+
+#endif	/* CONFIG_DM_NETLINK */
+
+#endif	/* DM_NETLINK_H */

Index: linux/drivers/md/dm.c
===================================================================

drivers/md/dm.c +2 -0
@@ -7,6 +7,7 @@
 
 #include "dm.h"
 #include "dm-bio-list.h"
+#include "dm-netlink.h"
 
 #include <linux/init.h>
 #include <linux/module.h>
@@ -176,6 +177,7 @@ int (*_inits[])(void) __initdata = {
 	dm_linear_init,
 	dm_stripe_init,
 	dm_interface_init,
+	dm_netlink_init,
 };
 
 void (*_exits[])(void) = {

drivers/md/dm.c void (*_exits[])(void) = { · line 190

Quoted 5 lines
drivers/md/dm.c +1 -0
@@ -184,6 +186,7 @@ void (*_exits[])(void) = {
 	dm_linear_exit,
 	dm_stripe_exit,
 	dm_interface_exit,
+	dm_netlink_exit,
 };

hm, so if CONFIG_DM_NETLINK=n we end up taking the address of an inlined function. So the __init above _did_ make sense, in a peculiar way. I don't know that gcc will actually put that converted-to-non-inline function into the desired section though.

There's no way in which those inlined functions will ever get inlined. Perhaps all this would be better if there was no implementation of dm_netlink_init() and dm_netlink_exit() if CONFIG_DM_NETLINK=n and you just whack the requisite ifdefs into these tables here?

include/linux/netlink.h line 26

Quoted 13 lines
drivers/md/dm.c +0 -0
 static int __init dm_init(void)

Index: linux/include/linux/netlink.h
===================================================================

include/linux/netlink.h +1 -1
@@ -21,7 +21,7 @@
 #define NETLINK_DNRTMSG		14	/* DECnet routing messages */
 #define NETLINK_KOBJECT_UEVENT	15	/* Kernel messages to userspace */
 #define NETLINK_GENERIC		16
-/* leave room for NETLINK_DM (DM Events) */
+#define NETLINK_DM		17	/* Device Mapper */
 #define NETLINK_SCSITRANSPORT	18	/* SCSI Transports */
 #define NETLINK_ECRYPTFS	19

Have the net guys checked this?

#2 lore raw
Quoted 10 lines · Andrew Morton
Quoted 7 lines · On Wed, 11 Jul 2007 22:01:37 +0100 Alasdair G Kergon <[email protected]> wrote:

From: Mike Anderson <[email protected]>

This patch adds a dm-netlink skeleton support to the Makefile, and the dm directory.

...

Quoted 8 lines

drivers/md/Kconfig config DM_DELAY · line 278

Quoted 5 lines
drivers/md/Kconfig +5 -0
+config DM_NETLINK
+	bool "DM netlink events (EXPERIMENTAL)"
+	depends on BLK_DEV_DM && EXPERIMENTAL
+	---help---
+	Generate netlink events for DM events.

Need a dependency on NET there?

Yes.

Quoted 56 lines

drivers/md/dm-netlink.h line 40

Quoted 10 lines

...

drivers/md/dm-netlink.h new file +8 -0
+#ifdef CONFIG_DM_NETLINK
+
+int dm_netlink_init(void);
+void dm_netlink_exit(void);
+
+#else	/* CONFIG_DM_NETLINK */
+
+static inline int __init dm_netlink_init(void)

The __init here isn't needed (doesn't make sense, is missing the required #include anyway)

Quoted 31 lines
drivers/md/dm-netlink.h new file +10 -0
+{
+	return 0;
+}
+static inline void dm_netlink_exit(void)
+{
+}
+
+#endif	/* CONFIG_DM_NETLINK */
+
+#endif	/* DM_NETLINK_H */

Index: linux/drivers/md/dm.c
===================================================================

drivers/md/dm.c +2 -0
@@ -7,6 +7,7 @@
 
 #include "dm.h"
 #include "dm-bio-list.h"
+#include "dm-netlink.h"
 
 #include <linux/init.h>
 #include <linux/module.h>
@@ -176,6 +177,7 @@ int (*_inits[])(void) __initdata = {
 	dm_linear_init,
 	dm_stripe_init,
 	dm_interface_init,
+	dm_netlink_init,
 };
 
 void (*_exits[])(void) = {

drivers/md/dm.c void (*_exits[])(void) = { · line 190

Quoted 5 lines
drivers/md/dm.c +1 -0
@@ -184,6 +186,7 @@ void (*_exits[])(void) = {
 	dm_linear_exit,
 	dm_stripe_exit,
 	dm_interface_exit,
+	dm_netlink_exit,
 };

hm, so if CONFIG_DM_NETLINK=n we end up taking the address of an inlined function. So the __init above _did_ make sense, in a peculiar way. I don't know that gcc will actually put that converted-to-non-inline function into the desired section though.

Quoted 5 lines

There's no way in which those inlined functions will ever get inlined. Perhaps all this would be better if there was no implementation of dm_netlink_init() and dm_netlink_exit() if CONFIG_DM_NETLINK=n and you just whack the requisite ifdefs into these tables here?

ok, I will switch to the ifdef CONFIG_DM_NETLINK in the tables.

Quoted 7 lines
Quoted 7 lines
drivers/md/dm.c +0 -0
 static int __init dm_init(void)

Index: linux/include/linux/netlink.h
===================================================================

include/linux/netlink.h +0 -0
@@ -21,7 +21,7 @@
 #define NETLINK_DNRTMSG		14	/* DECnet routing messages */
Quoted 8 lines

include/linux/netlink.h line 26

Quoted 6 lines
include/linux/netlink.h +1 -1
 #define NETLINK_KOBJECT_UEVENT	15	/* Kernel messages to userspace */
 #define NETLINK_GENERIC		16
-/* leave room for NETLINK_DM (DM Events) */
+#define NETLINK_DM		17	/* Device Mapper */
 #define NETLINK_SCSITRANSPORT	18	/* SCSI Transports */
 #define NETLINK_ECRYPTFS	19

Have the net guys checked this?

No. The support is a derivative of the netlink support in scsi_transport_iscsi.c.

-andmike
--
Michael Anderson
[email protected]

#3 lore raw
Quoted 13 lines · Mike Anderson
Quoted 4 lines
Quoted 4 lines
include/linux/netlink.h +0 -0
@@ -21,7 +21,7 @@
 #define NETLINK_DNRTMSG		14	/* DECnet routing messages */
Quoted 8 lines

include/linux/netlink.h line 26

Quoted 6 lines
include/linux/netlink.h +1 -1
 #define NETLINK_KOBJECT_UEVENT	15	/* Kernel messages to userspace */
 #define NETLINK_GENERIC		16
-/* leave room for NETLINK_DM (DM Events) */
+#define NETLINK_DM		17	/* Device Mapper */
 #define NETLINK_SCSITRANSPORT	18	/* SCSI Transports */
 #define NETLINK_ECRYPTFS	19

Have the net guys checked this?

Quoted 2 lines

No. The support is a derivative of the netlink support in scsi_transport_iscsi.c.

I'm not sure about all net guys, but the first question rised after reading this - why do you want special netlink family and do not want to use interfaces created on top of - like connector and genetlink?

Quoted 1 line

-andmike

Signature · 1 line
	Evgeniy Polyakov
maintainer
#4 lore raw

From: Evgeniy Polyakov <[email protected]>
Date: Thu, 12 Jul 2007 12:10:29 +0400

Quoted 14 lines · Mike Anderson
Quoted 13 lines
Quoted 12 lines

include/linux/netlink.h line 26

Quoted 10 lines
include/linux/netlink.h +1 -1
@@ -21,7 +21,7 @@
 #define NETLINK_DNRTMSG		14	/* DECnet routing messages */
 #define NETLINK_KOBJECT_UEVENT	15	/* Kernel messages to userspace */
 #define NETLINK_GENERIC		16
-/* leave room for NETLINK_DM (DM Events) */
+#define NETLINK_DM		17	/* Device Mapper */
 #define NETLINK_SCSITRANSPORT	18	/* SCSI Transports */
 #define NETLINK_ECRYPTFS	19

Have the net guys checked this?

Quoted 6 lines
Quoted 2 lines

No. The support is a derivative of the netlink support in scsi_transport_iscsi.c.

I'm not sure about all net guys, but the first question rised after reading this - why do you want special netlink family and do not want to use interfaces created on top of - like connector and genetlink?

I agree, there is really no reason to not at least use genetlink.

#5 lore raw
Quoted 20 lines · David Miller

From: Evgeniy Polyakov <[email protected]>
Date: Thu, 12 Jul 2007 12:10:29 +0400

Quoted 17 lines · Mike Anderson
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
include/linux/netlink.h +0 -0
@@ -21,7 +21,7 @@
 #define NETLINK_DNRTMSG		14	/* DECnet routing messages */
Quoted 8 lines

include/linux/netlink.h line 26

Quoted 6 lines
include/linux/netlink.h +1 -1
 #define NETLINK_KOBJECT_UEVENT	15	/* Kernel messages to userspace */
 #define NETLINK_GENERIC		16
-/* leave room for NETLINK_DM (DM Events) */
+#define NETLINK_DM		17	/* Device Mapper */
 #define NETLINK_SCSITRANSPORT	18	/* SCSI Transports */
 #define NETLINK_ECRYPTFS	19

Have the net guys checked this?

No. The support is a derivative of the netlink support in scsi_transport_iscsi.c.

Quoted 6 lines
Quoted 3 lines

I'm not sure about all net guys, but the first question rised after reading this - why do you want special netlink family and do not want to use interfaces created on top of - like connector and genetlink?

I agree, there is really no reason to not at least use genetlink.

ok, I will switch over to using genetlink.

-andmike
--
Michael Anderson
[email protected]

#6 lore raw
In reply to Andrew Morton
Quoted 10 lines · Andrew Morton
Quoted 7 lines · On Wed, 11 Jul 2007 22:01:37 +0100 Alasdair G Kergon <[email protected]> wrote:

From: Mike Anderson <[email protected]>

This patch adds a dm-netlink skeleton support to the Makefile, and the dm directory.

...

Quoted 7 lines

drivers/md/Kconfig config DM_DELAY · line 278

Quoted 5 lines
drivers/md/Kconfig +5 -0
+config DM_NETLINK
+	bool "DM netlink events (EXPERIMENTAL)"
+	depends on BLK_DEV_DM && EXPERIMENTAL
+	---help---
+	Generate netlink events for DM events.

Need a dependency on NET there?

It's really sad to make DM dependent on the network layer.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#7 lore raw
Quoted 19 lines · On Thu, 12 Jul 2007 18:19:20 -0500 Matt Mackall <[email protected]> wrote:
Quoted 10 lines · Andrew Morton
Quoted 7 lines · On Wed, 11 Jul 2007 22:01:37 +0100 Alasdair G Kergon <[email protected]> wrote:

From: Mike Anderson <[email protected]>

This patch adds a dm-netlink skeleton support to the Makefile, and the dm directory.

...

Quoted 7 lines

drivers/md/Kconfig config DM_DELAY · line 278

Quoted 5 lines
drivers/md/Kconfig +5 -0
+config DM_NETLINK
+	bool "DM netlink events (EXPERIMENTAL)"
+	depends on BLK_DEV_DM && EXPERIMENTAL
+	---help---
+	Generate netlink events for DM events.

Need a dependency on NET there?

Quoted 2 lines

It's really sad to make DM dependent on the network layer.

Yes, it would be somewhat sad. However one can presumably continue to use DM, just without "DM netlink events".

But that probably means that one will not be able to use the standard DM admin tools without networking. Maybe there will remain alternative but cruder ways to get things done?

#12 lore raw
In reply to Matt Mackall
Quoted 19 lines · Matt Mackall
Quoted 10 lines · Andrew Morton
Quoted 7 lines · On Wed, 11 Jul 2007 22:01:37 +0100 Alasdair G Kergon <[email protected]> wrote:

From: Mike Anderson <[email protected]>

This patch adds a dm-netlink skeleton support to the Makefile, and the dm directory.

...

Quoted 7 lines

drivers/md/Kconfig config DM_DELAY · line 278

Quoted 5 lines
drivers/md/Kconfig +5 -0
+config DM_NETLINK
+	bool "DM netlink events (EXPERIMENTAL)"
+	depends on BLK_DEV_DM && EXPERIMENTAL
+	---help---
+	Generate netlink events for DM events.

Need a dependency on NET there?

Quoted 1 line

It's really sad to make DM dependent on the network layer.

It wouldn't be all of dm. Only the netlink based event interface would be dependent.

-andmike
--
Michael Anderson
[email protected]

#8 lore raw
In reply to Andrew Morton
Quoted 22 lines · Andrew Morton
Quoted 19 lines · On Thu, 12 Jul 2007 18:19:20 -0500 Matt Mackall <[email protected]> wrote:
Quoted 17 lines · Andrew Morton

drivers/md/Kconfig config DM_DELAY · line 278

Quoted 12 lines · On Wed, 11 Jul 2007 22:01:37 +0100 Alasdair G Kergon <[email protected]> wrote:

From: Mike Anderson <[email protected]>

This patch adds a dm-netlink skeleton support to the Makefile, and the dm directory.

...

drivers/md/Kconfig +5 -0
+config DM_NETLINK
+	bool "DM netlink events (EXPERIMENTAL)"
+	depends on BLK_DEV_DM && EXPERIMENTAL
+	---help---
+	Generate netlink events for DM events.

Need a dependency on NET there?

Quoted 6 lines
Quoted 2 lines

It's really sad to make DM dependent on the network layer.

Yes, it would be somewhat sad. However one can presumably continue to use DM, just without "DM netlink events".

Yes, if you deselect you just do not receive the events through netlink.

Quoted 3 lines

But that probably means that one will not be able to use the standard DM admin tools without networking. Maybe there will remain alternative but cruder ways to get things done?

No, all admin tools and interfaces function as they do today. The dm-netlink patch series only contains 9 deletions (actual just one true deletion of existing kernel code the others are due to break up of the patch into compilable chunks). The intent was not to break users or force migration.

-andmike
--
Michael Anderson
[email protected]

#10 lore raw
In reply to Andrew Morton
Quoted 7 lines · Andrew Morton
Quoted 4 lines
Quoted 1 line

Need a dependency on NET there?

It's really sad to make DM dependent on the network layer.

Yes, it would be somewhat sad. However one can presumably continue to use DM, just without "DM netlink events".

On my machine device mapper (lvm, raid) does not work without sockets, (maybe not dm, but hotplug, which creates nodes, or configuration) so it already depends on it. Hotplug depends on networking.

You missed the day when everyone started to depend on networking :)

Signature · 1 line
	Evgeniy Polyakov
#11 lore raw
Quoted 6 lines · Evgeniy Polyakov
Quoted 5 lines · Andrew Morton
Quoted 4 lines
Quoted 1 line

Need a dependency on NET there?

It's really sad to make DM dependent on the network layer.

Quoted 8 lines
Quoted 2 lines

Yes, it would be somewhat sad. However one can presumably continue to use DM, just without "DM netlink events".

On my machine device mapper (lvm, raid) does not work without sockets, (maybe not dm, but hotplug, which creates nodes, or configuration) so it already depends on it. Hotplug depends on networking.

You missed the day when everyone started to depend on networking :)

Right, uevents (udev) depend on networking. One could still use the /sbin/hotplug fork-bomb, but boxes that don't want networking are often that small, that the amount of events the kernel creates today, leads immediately to OOM, because of too many event processes forked at the same time.

Kay

#9 lore raw
In reply to Mike Anderson
Quoted 5 lines · Mike Anderson

No, all admin tools and interfaces function as they do today. The dm-netlink patch series only contains 9 deletions (actual just one true deletion of existing kernel code the others are due to break up of the patch into compilable chunks). The intent was not to break users or force migration.

OK, I'll bite - if the admin tools function as before, who is *using* the code? Or do the admin tools have a preferred netlink component and a fallback set of code if that fails?