All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC V2] init: support device of major:minor:offset format
@ 2015-05-06  0:24 Chen Yu
  2015-05-06 16:49 ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Chen Yu @ 2015-05-06  0:24 UTC (permalink / raw)
  To: snitzer, rafael.j.wysocki; +Cc: linux-pm, linux-kernel, rui.zhang, Chen Yu

Distribution like Ubuntu uses klibc rather than uswsusp to resume
system from hibernation, which will treat swap partition/file in
the form of major:minor:offset. For example, 8:3:0 represents a
swap partition in klibc, and klibc's resume process in initrd will
finally echo 8:3:0 to /sys/power/resume for manually restoring.
However in current implementation, 8:3:0 will be treated as an invalid
device format, and it is found that manual resumming from hibernation
will fail on lastest kernel.

This patch adds support for device with major:minor:offset format
when resumming from hibernation.

Reported-by: Prigent Christophe <christophe.prigent@intel.com>
Reported-by: Martin Steigerwald <martin@lichtvoll.de>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
---
 init/do_mounts.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 8369ffa..e2e3538 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -225,10 +225,12 @@ dev_t name_to_dev_t(const char *name)
 #endif
 
 	if (strncmp(name, "/dev/", 5) != 0) {
-		unsigned maj, min;
+		unsigned maj, min, offset;
 		char dummy;
 
-		if (sscanf(name, "%u:%u%c", &maj, &min, &dummy) == 2) {
+		if ((sscanf(name, "%u:%u%c", &maj, &min, &dummy) == 2) ||
+		    (sscanf(name,
+			    "%u:%u:%u:%c", &maj, &min, &offset, &dummy) == 3)) {
 			res = MKDEV(maj, min);
 			if (maj != MAJOR(res) || min != MINOR(res))
 				goto fail;
-- 
1.9.1


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

* Re: [RFC V2] init: support device of major:minor:offset format
  2015-05-06  0:24 [RFC V2] init: support device of major:minor:offset format Chen Yu
@ 2015-05-06 16:49 ` Geert Uytterhoeven
  2015-05-07  1:42   ` Yu Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2015-05-06 16:49 UTC (permalink / raw)
  To: Chen Yu
  Cc: Mike Snitzer, Rafael J. Wysocki, Linux PM list, linux-kernel, Zhang Rui

On Wed, May 6, 2015 at 2:24 AM, Chen Yu <yu.c.chen@intel.com> wrote:
> Distribution like Ubuntu uses klibc rather than uswsusp to resume
> system from hibernation, which will treat swap partition/file in
> the form of major:minor:offset. For example, 8:3:0 represents a
> swap partition in klibc, and klibc's resume process in initrd will
> finally echo 8:3:0 to /sys/power/resume for manually restoring.
> However in current implementation, 8:3:0 will be treated as an invalid

Why can't klibc write the same information as uswsusp?
Why should the kernel adapt to a specific piece of userspace?

> device format, and it is found that manual resumming from hibernation
> will fail on lastest kernel.

Is this a regression, perhaps introduced by commit 283e7ad024115571
("init: stricter checking of major:minor root= values")? If that is the case,
please say so.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [RFC V2] init: support device of major:minor:offset format
  2015-05-06 16:49 ` Geert Uytterhoeven
@ 2015-05-07  1:42   ` Yu Chen
  2015-05-07  7:04     ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Yu Chen @ 2015-05-07  1:42 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Mike Snitzer, Rafael J. Wysocki, Linux PM list, linux-kernel, Zhang Rui

Hi, Geert

On 05/07/2015 12:49 AM, Geert Uytterhoeven wrote:
> On Wed, May 6, 2015 at 2:24 AM, Chen Yu <yu.c.chen@intel.com> wrote:
>> Distribution like Ubuntu uses klibc rather than uswsusp to resume
>> system from hibernation, which will treat swap partition/file in
>> the form of major:minor:offset. For example, 8:3:0 represents a
>> swap partition in klibc, and klibc's resume process in initrd will
>> finally echo 8:3:0 to /sys/power/resume for manually restoring.
>> However in current implementation, 8:3:0 will be treated as an invalid
>
> Why can't klibc write the same information as uswsusp?
I agree. However it seems that klibc treats all device/file as such
fixed format when dealing with hibernation, I guess that might be
easier for it to implement?

> Why should the kernel adapt to a specific piece of userspace?
>
>> device format, and it is found that manual resumming from hibernation
>> will fail on lastest kernel.
>
> Is this a regression, perhaps introduced by commit 283e7ad024115571
> ("init: stricter checking of major:minor root= values")? If that is the case,
> please say so.
>
yes, it is. I think there's a modified patch for it at:

https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=cb31ef485dd4c6a205d1064b42027f82076d00c8


Thanks

Best Regards,
Yu

> Gr{oetje,eeting}s,
>
>                          Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                  -- Linus Torvalds
>


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

* Re: [RFC V2] init: support device of major:minor:offset format
  2015-05-07  1:42   ` Yu Chen
@ 2015-05-07  7:04     ` Geert Uytterhoeven
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2015-05-07  7:04 UTC (permalink / raw)
  To: Yu Chen
  Cc: Mike Snitzer, Rafael J. Wysocki, Linux PM list, linux-kernel, Zhang Rui

On Thu, May 7, 2015 at 3:42 AM, Yu Chen <yu.c.chen@intel.com> wrote:
> On 05/07/2015 12:49 AM, Geert Uytterhoeven wrote:
>>
>> On Wed, May 6, 2015 at 2:24 AM, Chen Yu <yu.c.chen@intel.com> wrote:
>>>
>>> Distribution like Ubuntu uses klibc rather than uswsusp to resume
>>> system from hibernation, which will treat swap partition/file in
>>> the form of major:minor:offset. For example, 8:3:0 represents a
>>> swap partition in klibc, and klibc's resume process in initrd will
>>> finally echo 8:3:0 to /sys/power/resume for manually restoring.
>>> However in current implementation, 8:3:0 will be treated as an invalid
>>
>>
>> Why can't klibc write the same information as uswsusp?
>
> I agree. However it seems that klibc treats all device/file as such
> fixed format when dealing with hibernation, I guess that might be
> easier for it to implement?
>
>> Why should the kernel adapt to a specific piece of userspace?
>>
>>> device format, and it is found that manual resumming from hibernation
>>> will fail on lastest kernel.
>>
>>
>> Is this a regression, perhaps introduced by commit 283e7ad024115571
>> ("init: stricter checking of major:minor root= values")? If that is the
>> case,
>> please say so.
>>
> yes, it is. I think there's a modified patch for it at:
>
> https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=cb31ef485dd4c6a205d1064b42027f82076d00c8

OK, thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2015-05-07  7:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-06  0:24 [RFC V2] init: support device of major:minor:offset format Chen Yu
2015-05-06 16:49 ` Geert Uytterhoeven
2015-05-07  1:42   ` Yu Chen
2015-05-07  7:04     ` Geert Uytterhoeven

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.