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 the kernel



The following reply was made to PR kern/42799; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/42799: LVM logical volumes fail to attach if
        'pseudo-device dm' is compiled in the kernel
Date: Sun, 28 Feb 2010 23:35:32 +0000

 This whole discussion wasn't sent to gnats...
 
    ------
 
 From: Brian <brian%planetunix.net@localhost>
 To: netbsd-bugs%netbsd.org@localhost, hugo%barafranca.com@localhost, 
haad%netbsd.org@localhost
 Subject: Re: kern/42799: LVM logical volumes fail to attach if 'pseudo-device
        dm' is compiled in th kernel
 Date: Wed, 17 Feb 2010 20:39:47 -0500
 
 -----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();
 
 
 
 From: Manuel Bouyer <bouyer%antioche.eu.org@localhost>
 To: Brian <brian%planetunix.net@localhost>
 Cc: netbsd-bugs%NetBSD.org@localhost, hugo%barafranca.com@localhost, 
haad%NetBSD.org@localhost
 Subject: Re: kern/42799: LVM logical volumes fail to attach if 'pseudo-device
        dm' is compiled in th kernel
 Date: Thu, 18 Feb 2010 19:56:01 +0100
 
 On Wed, Feb 17, 2010 at 08:39:47PM -0500, Brian wrote:
 > [...]
 > 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.
 
 This is not a bug, but a much, much deeper issue: different ABI.
 NetBSD/native and NetBSD/Xen are really different machines, I really
 don't think we want to share modules between the two.
 
 -- 
 Manuel Bouyer <bouyer%antioche.eu.org@localhost>
      NetBSD: 26 ans d'experience feront toujours la difference
 --
 
 
 From: haad <haaaad%gmail.com@localhost>
 To: Manuel Bouyer <bouyer%antioche.eu.org@localhost>
 Cc: Brian <brian%planetunix.net@localhost>, netbsd-bugs%netbsd.org@localhost,
        hugo%barafranca.com@localhost
 Subject: Re: kern/42799: LVM logical volumes fail to attach if 'pseudo-device 
        dm' is compiled in th kernel
 Date: Thu, 18 Feb 2010 22:07:44 +0100
 
 hi,
 
 On Thu, Feb 18, 2010 at 7:56 PM, Manuel Bouyer 
<bouyer%antioche.eu.org@localhost> wrote:
 > On Wed, Feb 17, 2010 at 08:39:47PM -0500, Brian wrote:
 >> [...]
 >> 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.
 >
 > This is not a bug, but a much, much deeper issue: different ABI.
 > NetBSD/native and NetBSD/Xen are really different machines, I really
 > don't think we want to share modules between the two.
 
 Then it should be possible to build modules for NetBSD/Xen. Modules doesn't
 need to be shared but should be loadable and buildable for xen.
 
 
 
 -- 
 
 
 Regards.
 
 Adam
 
 
 From: Manuel Bouyer <bouyer%antioche.eu.org@localhost>
 To: haad <haaaad%gmail.com@localhost>
 Cc: Brian <brian%planetunix.net@localhost>, netbsd-bugs%netbsd.org@localhost,
        hugo%barafranca.com@localhost
 Subject: Re: kern/42799: LVM logical volumes fail to attach if 'pseudo-device
        dm' is compiled in th kernel
 Date: Thu, 18 Feb 2010 23:21:27 +0100
 
 On Thu, Feb 18, 2010 at 10:07:44PM +0100, haad wrote:
 > Then it should be possible to build modules for NetBSD/Xen. Modules doesn't
 > need to be shared but should be loadable and buildable for xen.
 
 Sure. The build system doesn't support this at this time ...
 
 -- 
 Manuel Bouyer <bouyer%antioche.eu.org@localhost>
      NetBSD: 26 ans d'experience feront toujours la difference
 --
 
 
 From: matthew green <mrg%eterna.com.au@localhost>
 to: Manuel Bouyer <bouyer%antioche.eu.org@localhost>
 cc: Brian <brian%planetunix.net@localhost>, netbsd-bugs%netbsd.org@localhost,
        hugo%barafranca.com@localhost, haad <haaaad%gmail.com@localhost>
 subject: re: kern/42799: LVM logical volumes fail to attach if 'pseudo-device
        dm' is compiled in th kernel
 Date: Sat, 20 Feb 2010 14:30:05 +1100
 
 
    On Thu, Feb 18, 2010 at 10:07:44PM +0100, haad wrote:
    > Then it should be possible to build modules for NetBSD/Xen. Modules 
doesn't
    > need to be shared but should be loadable and buildable for xen.
    
    Sure. The build system doesn't support this at this time ...
 
 
 i hope to have a solution for this in place for netbsd-6, reusing
 the work i've done in src/compat.
 
 
 .mrg.
 
 
 From: haad <haaaad%gmail.com@localhost>
 To: Brian <brian%planetunix.net@localhost>
 Cc: netbsd-bugs%netbsd.org@localhost, hugo%barafranca.com@localhost
 Subject: Re: kern/42799: LVM logical volumes fail to attach if 'pseudo-device 
        dm' is compiled in th kernel
 Date: Thu, 18 Feb 2010 22:18:23 +0100
 
 On Thu, Feb 18, 2010 at 2:39 AM, Brian <brian%planetunix.net@localhost> wrote:
 > -----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.
 
 
 I think that we need to change dmdetach routine as well.  Because it
 is called from shutdown hooks ?
 
 -- 
 
 
 Regards.
 
 Adam
 
 
 From: Brian <brian%planetunix.net@localhost>
 To: haad <haaaad%gmail.com@localhost>
 CC: netbsd-bugs%NetBSD.org@localhost, hugo%barafranca.com@localhost
 Subject: Re: kern/42799: LVM logical volumes fail to attach if 'pseudo-device
        dm' is compiled in th kernel
 Date: Thu, 18 Feb 2010 21:00:40 -0500
 
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 haad wrote:
 > 
 > I think that we need to change dmdetach routine as well.  Because it
 > is called from shutdown hooks ?
 > 
 
 Yes, it looks like dmdestroy and dm_modcmd for MODULE_CMD_FINI should
 probably also be refactored to call config_cfattach_detach in dmdestroy.
 
 Sincerely,
 Brian Brombacher
 PlanetUnix Networks
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.9 (OpenBSD)
 
 iEYEARECAAYFAkt98McACgkQGTUZ+lOxJfDlNwCfSrmYyL5hb8MiYKxQn6Hfmv0s
 334Anj+NaZSc4g8QyJhD8Et8e6xulFxB
 =SJS4
 -----END PGP SIGNATURE-----
 
 
 From: Hugo Silva <hugo%barafranca.com@localhost>
 To: Brian <brian%planetunix.net@localhost>
 CC: haad <haaaad%gmail.com@localhost>, netbsd-bugs%NetBSD.org@localhost
 Subject: Re: kern/42799: LVM logical volumes fail to attach if 'pseudo-device
        dm' is compiled in th kernel
 Date: Sat, 20 Feb 2010 20:23:48 +0000
 
 Brian wrote:
 > -----BEGIN PGP SIGNED MESSAGE-----
 > Hash: SHA1
 >
 > haad wrote:
 >   
 >> I think that we need to change dmdetach routine as well.  Because it
 >> is called from shutdown hooks ?
 >>
 >>     
 >
 > Yes, it looks like dmdestroy and dm_modcmd for MODULE_CMD_FINI should
 > probably also be refactored to call config_cfattach_detach in dmdestroy.
 >
 > Sincerely,
 > Brian Brombacher
 > PlanetUnix Networks
 > -----BEGIN PGP SIGNATURE-----
 > Version: GnuPG v1.4.9 (OpenBSD)
 >
 > iEYEARECAAYFAkt98McACgkQGTUZ+lOxJfDlNwCfSrmYyL5hb8MiYKxQn6Hfmv0s
 > 334Anj+NaZSc4g8QyJhD8Et8e6xulFxB
 > =SJS4
 > -----END PGP SIGNATURE-----
 >   
 
 I confirm the patch works as expected. I am now able to use lvm when  
 'pseudo-device dm' is in the kernel.
 


Home | Main Index | Thread Index | Old Index