All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Enable /dev/mapper/dm-[0-9]-* scanning
@ 2018-05-10 13:32 Oleg Solovyov
  2018-05-10 19:35 ` Daniel Kiper
  0 siblings, 1 reply; 8+ messages in thread
From: Oleg Solovyov @ 2018-05-10 13:32 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 1039 bytes --]

This code was modified because the original code skips any device with 
basename starts with /dm-[0-9]/
e.g. if the root device path is //dev/mapper/dm-0-luks/ it won't be 
detected by grub-probe and "root=" parameter in grub.cfg will be empty 
and the system will be unbootable unless you manually edit grub.cfg

BUG: https://savannah.gnu.org/bugs/?53697

> diff --git a/grub/grub-core/osdep/unix/getroot.c 
> b/grub/grub-core/osdep/unix/getroot.c
> index 4bf37b0..2964dcd 100644
> --- a/grub/grub-core/osdep/unix/getroot.c
> +++ b/grub/grub-core/osdep/unix/getroot.c
> @@ -433,7 +433,8 @@ grub_find_device (const char *dir, dev_t dev)
>            ent->d_name[1] == 'm' &&
>            ent->d_name[2] == '-' &&
>            ent->d_name[3] >= '0' &&
> -          ent->d_name[3] <= '9')
> +          ent->d_name[3] <= '9' &&
> +          ent->d_name[4] == '\0')
>          continue;
>  #endif
>
PS
I don't know what to do in case of //dev/dm-[0-9]+$/ yet

[-- Attachment #2: Type: text/html, Size: 1605 bytes --]

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

* Re: [PATCH] Enable /dev/mapper/dm-[0-9]-* scanning
  2018-05-10 13:32 [PATCH] Enable /dev/mapper/dm-[0-9]-* scanning Oleg Solovyov
@ 2018-05-10 19:35 ` Daniel Kiper
  2018-05-11 11:32   ` Oleg Solovyov
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Kiper @ 2018-05-10 19:35 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: mcpain, dkiper

On Thu, May 10, 2018 at 04:32:46PM +0300, Oleg Solovyov wrote:
> This code was modified because the original code skips any device with
> basename starts with /dm-[0-9]/
> e.g. if the root device path is //dev/mapper/dm-0-luks/ it won't be
> detected by grub-probe and "root=" parameter in grub.cfg will be empty
> and the system will be unbootable unless you manually edit grub.cfg
>
> BUG: https://savannah.gnu.org/bugs/?53697
>
> >diff --git a/grub/grub-core/osdep/unix/getroot.c
> >b/grub/grub-core/osdep/unix/getroot.c
> >index 4bf37b0..2964dcd 100644
> >--- a/grub/grub-core/osdep/unix/getroot.c
> >+++ b/grub/grub-core/osdep/unix/getroot.c
> >@@ -433,7 +433,8 @@ grub_find_device (const char *dir, dev_t dev)
> >???????? ?????????? ent->d_name[1] == 'm' &&
> >???????? ?????????? ent->d_name[2] == '-' &&
> >???????? ?????????? ent->d_name[3] >= '0' &&
> >-?????? ?????????? ent->d_name[3] <= '9')
> >+?????? ?????????? ent->d_name[3] <= '9' &&
> >+?????? ?????????? ent->d_name[4] == '\0')
> >???????? ?????? continue;
> >??#endif
> >
> PS
> I don't know what to do in case of //dev/dm-[0-9]+$/ yet

Your solution is not reliable. What about /dev/dm-10? I think that you
should add check for /dev directory. This should work much better.

Additionally, please use git format-patch/send-email to create and send
patches. And do not forget about SOB (Signed-off-by).

Good example is here: http://lists.gnu.org/archive/html/grub-devel/2018-04/msg00055.html

Daniel


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

* [PATCH] Enable /dev/mapper/dm-[0-9]-* scanning
  2018-05-10 19:35 ` Daniel Kiper
@ 2018-05-11 11:32   ` Oleg Solovyov
  2018-05-14 17:13     ` Daniel Kiper
  0 siblings, 1 reply; 8+ messages in thread
From: Oleg Solovyov @ 2018-05-11 11:32 UTC (permalink / raw)
  To: grub-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 44 bytes --]

Thanks for review
New version is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: 0001-Don-t-skip-dev-mapper-dm-devices.patch --]
[-- Type: text/x-patch; name="0001-Don-t-skip-dev-mapper-dm-devices.patch", Size: 1394 bytes --]

From 19e3f13632a20a0b1be12b6d6ff4c52ba4f3b4d6 Mon Sep 17 00:00:00 2001
From: Oleg Solovyov <mcpain@altlinux.org>
Date: Fri, 11 May 2018 13:55:46 +0300
Subject: [PATCH] Don't skip /dev/mapper/dm-* devices

This patch ensures that grub-probe will find the root device placed in
/dev/mapper/dm-[0-9]+-.*
e.g. device named /dev/mapper/dm-0-luks will be found and grub.cfg will
be updated properly, enabling the system to boot.

Signed-off-by: Oleg Solovyov <mcpain@altlinux.org>
---
 grub/grub-core/osdep/unix/getroot.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/grub/grub-core/osdep/unix/getroot.c b/grub/grub-core/osdep/unix/getroot.c
index 4bf37b0..41d6574 100644
--- a/grub/grub-core/osdep/unix/getroot.c
+++ b/grub/grub-core/osdep/unix/getroot.c
@@ -428,8 +428,10 @@ grub_find_device (const char *dir, dev_t dev)
 	{
 #ifdef __linux__
 	  /* Skip device names like /dev/dm-0, which are short-hand aliases
-	     to more descriptive device names, e.g. those under /dev/mapper */
-	  if (ent->d_name[0] == 'd' &&
+	     to more descriptive device names, e.g. those under /dev/mapper
+	     Also, don't skip devices under /dev/mapper */
+	  if (strcmp (dir, "/dev") == 0 &&
+	      ent->d_name[0] == 'd' &&
 	      ent->d_name[1] == 'm' &&
 	      ent->d_name[2] == '-' &&
 	      ent->d_name[3] >= '0' &&
-- 
2.10.2








[-- Attachment #1.1.3: 0x2BF8DBCCCFE5AD4F.asc --]
[-- Type: application/pgp-keys, Size: 3125 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] Enable /dev/mapper/dm-[0-9]-* scanning
  2018-05-11 11:32   ` Oleg Solovyov
@ 2018-05-14 17:13     ` Daniel Kiper
  2018-05-29 11:57       ` Oleg Solovyov
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Kiper @ 2018-05-14 17:13 UTC (permalink / raw)
  To: mcpain; +Cc: grub-devel, dkiper

On Fri, May 11, 2018 at 02:32:48PM +0300, Oleg Solovyov wrote:
> Thanks for review
> New version is attached
>
> From 19e3f13632a20a0b1be12b6d6ff4c52ba4f3b4d6 Mon Sep 17 00:00:00 2001
> From: Oleg Solovyov <mcpain@altlinux.org>
> Date: Fri, 11 May 2018 13:55:46 +0300
> Subject: [PATCH] Don't skip /dev/mapper/dm-* devices
>
> This patch ensures that grub-probe will find the root device placed in
> /dev/mapper/dm-[0-9]+-.*
> e.g. device named /dev/mapper/dm-0-luks will be found and grub.cfg will
> be updated properly, enabling the system to boot.
>
> Signed-off-by: Oleg Solovyov <mcpain@altlinux.org>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

If there are no objections I will apply this patch in a week or so.

Next time please use "git send-email" to send the patches.

Daniel


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

* Re: [PATCH] Enable /dev/mapper/dm-[0-9]-* scanning
  2018-05-14 17:13     ` Daniel Kiper
@ 2018-05-29 11:57       ` Oleg Solovyov
  2018-05-29 13:50         ` Vladimir 'phcoder' Serbinenko
  0 siblings, 1 reply; 8+ messages in thread
From: Oleg Solovyov @ 2018-05-29 11:57 UTC (permalink / raw)
  To: grub-devel


[-- Attachment #1.1: Type: text/plain, Size: 1062 bytes --]

Anybody?


14.05.2018 20:13, Daniel Kiper пишет:
> On Fri, May 11, 2018 at 02:32:48PM +0300, Oleg Solovyov wrote:
>> Thanks for review
>> New version is attached
>>
>> From 19e3f13632a20a0b1be12b6d6ff4c52ba4f3b4d6 Mon Sep 17 00:00:00 2001
>> From: Oleg Solovyov <mcpain@altlinux.org>
>> Date: Fri, 11 May 2018 13:55:46 +0300
>> Subject: [PATCH] Don't skip /dev/mapper/dm-* devices
>>
>> This patch ensures that grub-probe will find the root device placed in
>> /dev/mapper/dm-[0-9]+-.*
>> e.g. device named /dev/mapper/dm-0-luks will be found and grub.cfg will
>> be updated properly, enabling the system to boot.
>>
>> Signed-off-by: Oleg Solovyov <mcpain@altlinux.org>
> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
>
> If there are no objections I will apply this patch in a week or so.
>
> Next time please use "git send-email" to send the patches.
>
> Daniel
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] Enable /dev/mapper/dm-[0-9]-* scanning
  2018-05-29 11:57       ` Oleg Solovyov
@ 2018-05-29 13:50         ` Vladimir 'phcoder' Serbinenko
  2018-05-29 13:55           ` Oleg Solovyov
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2018-05-29 13:50 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 1488 bytes --]

On Tue, 29 May 2018, 13:58 Oleg Solovyov, <mcpain@basealt.ru> wrote:

> Anybody?
>
Why do you need this? Normally the same devices should be under
/dev/mapper. Using dm-X will mess up some other code most likely

>
>
> 14.05.2018 20:13, Daniel Kiper пишет:
> > On Fri, May 11, 2018 at 02:32:48PM +0300, Oleg Solovyov wrote:
> >> Thanks for review
> >> New version is attached
> >>
> >> From 19e3f13632a20a0b1be12b6d6ff4c52ba4f3b4d6 Mon Sep 17 00:00:00 2001
> >> From: Oleg Solovyov <mcpain@altlinux.org>
> >> Date: Fri, 11 May 2018 13:55:46 +0300
> >> Subject: [PATCH] Don't skip /dev/mapper/dm-* devices
> >>
> >> This patch ensures that grub-probe will find the root device placed in
> >> /dev/mapper/dm-[0-9]+-.*
> >> e.g. device named /dev/mapper/dm-0-luks will be found and grub.cfg will
> >> be updated properly, enabling the system to boot.
> >>
> >> Signed-off-by: Oleg Solovyov <mcpain@altlinux.org>
> > Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
> >
> > If there are no objections I will apply this patch in a week or so.
> >
> > Next time please use "git send-email" to send the patches.
> >
> > Daniel
> >
> > _______________________________________________
> > Grub-devel mailing list
> > Grub-devel@gnu.org
> > https://lists.gnu.org/mailman/listinfo/grub-devel
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>

[-- Attachment #2: Type: text/html, Size: 2570 bytes --]

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

* Re: [PATCH] Enable /dev/mapper/dm-[0-9]-* scanning
  2018-05-29 13:50         ` Vladimir 'phcoder' Serbinenko
@ 2018-05-29 13:55           ` Oleg Solovyov
  2018-05-29 14:31             ` Daniel Kiper
  0 siblings, 1 reply; 8+ messages in thread
From: Oleg Solovyov @ 2018-05-29 13:55 UTC (permalink / raw)
  To: grub-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 2279 bytes --]

29.05.2018 16:50, Vladimir 'phcoder' Serbinenko пишет:
>
>
> On Tue, 29 May 2018, 13:58 Oleg Solovyov, <mcpain@basealt.ru
> <mailto:mcpain@basealt.ru>> wrote:
>
>     Anybody?
>
> Why do you need this? Normally the same devices should be under
> /dev/mapper. Using dm-X will mess up some other code most likely
What happens if you have /dev/mapper/dm-0-luks symlinked to /dev/dm-0?
This device will be skipped because basename starts with dm-0
There's no checking whether device is under /dev/mapper or not yet.
>
>
>
>     14.05.2018 20:13, Daniel Kiper пишет:
>     > On Fri, May 11, 2018 at 02:32:48PM +0300, Oleg Solovyov wrote:
>     >> Thanks for review
>     >> New version is attached
>     >>
>     >> From 19e3f13632a20a0b1be12b6d6ff4c52ba4f3b4d6 Mon Sep 17
>     00:00:00 2001
>     >> From: Oleg Solovyov <mcpain@altlinux.org
>     <mailto:mcpain@altlinux.org>>
>     >> Date: Fri, 11 May 2018 13:55:46 +0300
>     >> Subject: [PATCH] Don't skip /dev/mapper/dm-* devices
>     >>
>     >> This patch ensures that grub-probe will find the root device
>     placed in
>     >> /dev/mapper/dm-[0-9]+-.*
>     >> e.g. device named /dev/mapper/dm-0-luks will be found and
>     grub.cfg will
>     >> be updated properly, enabling the system to boot.
>     >>
>     >> Signed-off-by: Oleg Solovyov <mcpain@altlinux.org
>     <mailto:mcpain@altlinux.org>>
>     > Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com
>     <mailto:daniel.kiper@oracle.com>>
>     >
>     > If there are no objections I will apply this patch in a week or so.
>     >
>     > Next time please use "git send-email" to send the patches.
>     >
>     > Daniel
>     >
>     > _______________________________________________
>     > Grub-devel mailing list
>     > Grub-devel@gnu.org <mailto:Grub-devel@gnu.org>
>     > https://lists.gnu.org/mailman/listinfo/grub-devel
>
>
>     _______________________________________________
>     Grub-devel mailing list
>     Grub-devel@gnu.org <mailto:Grub-devel@gnu.org>
>     https://lists.gnu.org/mailman/listinfo/grub-devel
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel


[-- Attachment #1.1.2: Type: text/html, Size: 4640 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] Enable /dev/mapper/dm-[0-9]-* scanning
  2018-05-29 13:55           ` Oleg Solovyov
@ 2018-05-29 14:31             ` Daniel Kiper
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Kiper @ 2018-05-29 14:31 UTC (permalink / raw)
  To: mcpain; +Cc: grub-devel, phcoder

On Tue, May 29, 2018 at 04:55:10PM +0300, Oleg Solovyov wrote:
> 29.05.2018 16:50, Vladimir 'phcoder' Serbinenko ??????????:
> >
> >
> > On Tue, 29 May 2018, 13:58 Oleg Solovyov, <mcpain@basealt.ru
> > <mailto:mcpain@basealt.ru>> wrote:
> >
> >     Anybody?
> >
> > Why do you need this? Normally the same devices should be under
> > /dev/mapper. Using dm-X will mess up some other code most likely
> What happens if you have /dev/mapper/dm-0-luks symlinked to /dev/dm-0?
> This device will be skipped because basename starts with dm-0
> There's no checking whether device is under /dev/mapper or not yet.

I have just pushed the patch. Sorry for delay but I was traveling recently.

Daniel


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

end of thread, other threads:[~2018-05-29 14:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-10 13:32 [PATCH] Enable /dev/mapper/dm-[0-9]-* scanning Oleg Solovyov
2018-05-10 19:35 ` Daniel Kiper
2018-05-11 11:32   ` Oleg Solovyov
2018-05-14 17:13     ` Daniel Kiper
2018-05-29 11:57       ` Oleg Solovyov
2018-05-29 13:50         ` Vladimir 'phcoder' Serbinenko
2018-05-29 13:55           ` Oleg Solovyov
2018-05-29 14:31             ` Daniel Kiper

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.