NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/42799: LVM logical volumes fail to attach if 'pseudo-device dm' is compiled in th kernel



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Good evening all,

I have provided a patch below to fix kern/42799: LVM logical volumes
fail to attach if 'pseudo-device dm' is compiled in th kernel.

The device-mapper written by Adam Hamsik for his GSoC project cannot be
used as a builtin kernel module due to a bug.

I have modified sys/dev/dm/device-mapper.c to fix this by calling
config_cfattach_attach from dmattach and changed the order in which
dmattach is called in dm_modcmd during module initialization.

This allows LVM to be used under NetBSD/Xen dom0 and domU.  A different
bug related to module loading for NetBSD/Xen prevents the device-mapper
from being used as a module.

I have not tested this change built as a module because I cannot load
any modules on my NetBSD/Xen systems.  I will look into the module
loading issue and create a patch at a later time.

I have provided the patch inline below and as a file attachment.

Sorry for creating a new thread as I was not on the list during the
original bug report so I cannot 'Reply' to it directly.

Sincerely,
Brian Brombacher
PlanetUnix Networks

Index: sys/dev/dm/device-mapper.c
===================================================================
RCS file: /cvsroot/src/sys/dev/dm/device-mapper.c,v
retrieving revision 1.15
diff -u -r1.15 device-mapper.c
- --- sys/dev/dm/device-mapper.c  8 Jan 2010 00:27:48 -0000       1.15
+++ sys/dev/dm/device-mapper.c  18 Feb 2010 01:17:20 -0000
@@ -156,16 +156,13 @@

        switch (cmd) {
        case MODULE_CMD_INIT:
- -             dmattach();
- -
                error = config_cfdriver_attach(&dm_cd);
                if (error)
                        break;

- -             error = config_cfattach_attach(dm_cd.cd_name, &dm_ca);
+               error = dmattach();
                if (error) {
                        config_cfdriver_detach(&dm_cd);
- -                     aprint_error("Unable to register cfattach for dm 
driver\n");

                        break;
                }
@@ -279,6 +276,14 @@
 int
 dmattach(void)
 {
+       int error;
+
+       error = config_cfattach_attach(dm_cd.cd_name, &dm_ca);
+       if (error) {
+               aprint_error("Unable to register cfattach for dm driver\n");
+
+               return error;
+       }

        dm_target_init();
        dm_dev_init();

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (OpenBSD)

iEYEARECAAYFAkt8mmEACgkQGTUZ+lOxJfCMZACgnAt7+CPpunwXgcvXXjnbJl9R
kQcAoKCMyH8YVztdg6DWaZ+njA+l9oIW
=yo+S
-----END PGP SIGNATURE-----
Index: sys/dev/dm/device-mapper.c
===================================================================
RCS file: /cvsroot/src/sys/dev/dm/device-mapper.c,v
retrieving revision 1.15
diff -u -r1.15 device-mapper.c
--- sys/dev/dm/device-mapper.c  8 Jan 2010 00:27:48 -0000       1.15
+++ sys/dev/dm/device-mapper.c  18 Feb 2010 01:17:20 -0000
@@ -156,16 +156,13 @@
 
        switch (cmd) {
        case MODULE_CMD_INIT:
-               dmattach();
-
                error = config_cfdriver_attach(&dm_cd);
                if (error)
                        break;
 
-               error = config_cfattach_attach(dm_cd.cd_name, &dm_ca);
+               error = dmattach();
                if (error) {
                        config_cfdriver_detach(&dm_cd);
-                       aprint_error("Unable to register cfattach for dm 
driver\n");
 
                        break;
                }
@@ -279,6 +276,14 @@
 int
 dmattach(void)
 {
+       int error;
+
+       error = config_cfattach_attach(dm_cd.cd_name, &dm_ca);
+       if (error) {
+               aprint_error("Unable to register cfattach for dm driver\n");
+
+               return error;
+       }
 
        dm_target_init();
        dm_dev_init();


Home | Main Index | Thread Index | Old Index