From: Andrew Savchenko <bircoph@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org, viro@zeniv.linux.org.uk,
suspend-devel@lists.sourceforge.net
Subject: 3.7-rc regression bisected: s2disk fails to resume image: Processes could not be frozen, cannot continue resuming
Date: Mon, 12 Aug 2013 23:44:15 +0400 [thread overview]
Message-ID: <20130812234415.7db639bb0d664e56b6ab2ab2@gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 2825 bytes --]
Hello,
after a kernel update from 3.5.7 to the latest stable I found that
user-space resume (from suspend-1.0 aka uswsusp) no longer works.
Kernel-space suspend and resume work fine (e.g. echo disk
> /sys/power/state), problem is with user-space support. (I need
user-space version because it supports image encryption.)
After resume (essentially linuxrc) application loads image it fails
to apply it:
========================================================
Processes could not be frozen, cannot continue resuming.
Error 11: Resource temporarily unavailable
You can now boot the system and lose the saved state
or reboot and try again.
[Notice that if you decide to reboot, you MUST NOT mount
any filesystems before a successful resume.
Resuming after some filesystems have been mounted
will badly damage these filesystems.]
Do you want to continue booting (Y/n)?
========================================================
Error code wasn't originally showed, I added it to suspend tool to
aid debugging. Essentially freeze ioctl on /dev/snapshot fails with
this error.
I bisected a commit which introduces this bug:
========================================================
commit ba4df2808a86f8b103c4db0b8807649383e9bd13
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Tue Oct 2 15:29:10 2012 -0400
don't bother with kernel_thread/kernel_execve for launching
linuxrc
exec_usermodehelper_fns() will do just fine...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
========================================================
In fact this commit induced/triggered at least two bugs: the first one
I'm facing now and the second one was fixed in commit
f0de17c0babe7f29381892def6b37e9181a53410:
make sure that /linuxrc has std{in,out,err}.
As a temporarily workaround for this issue I reverted all changes for
init/do_mounts_initrd.c up to the latest working commit
cb450766bcafc7bd7d40e9a5a0050745e8c68b3e considering the kernel API
changes (kernel_execve -> sys_execve). See linuxrc-workaround.patch.
I understand this isn't a proper solution, I just want to show what
code works for me.
I also found an interesting LKML discussion about s2disk and freezer
issue: http://www.spinics.net/lists/linux-nfs/msg38160.html
Maybe it is related to this bug, but patch proposed there doesn't in
my case.
Kernel config which fails with
ba4df2808a86f8b103c4db0b8807649383e9bd13 and works with
f0de17c0babe7f29381892def6b37e9181a53410 is also attached.
As this issue maybe hardware related, the system is 32-bit EEE PC
1000H with Atom N270, 2GB RAM, 750 GB SATA drive.
Additional (but probably useless) information on this bug may be found
here: https://forums.gentoo.org/viewtopic-p-7371120.html
Best regards,
Andrew Savchenko
[-- Attachment #1.2: config.xz --]
[-- Type: application/octet-stream, Size: 9816 bytes --]
[-- Attachment #1.3: linuxrc-workaround.patch --]
[-- Type: application/octet-stream, Size: 3030 bytes --]
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
index 3e0878e..9b261ec 100644
--- a/init/do_mounts_initrd.c
+++ b/init/do_mounts_initrd.c
@@ -16,13 +16,13 @@
#include <linux/initrd.h>
#include <linux/sched.h>
#include <linux/freezer.h>
-#include <linux/kmod.h>
#include "do_mounts.h"
unsigned long initrd_start, initrd_end;
int initrd_below_start_ok;
unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */
+static int __initdata old_fd, root_fd;
static int __initdata mount_initrd = 1;
static int __init no_initrd(char *str)
@@ -33,37 +33,33 @@ static int __init no_initrd(char *str)
__setup("noinitrd", no_initrd);
-static int init_linuxrc(struct subprocess_info *info, struct cred *new)
+static int __init do_linuxrc(void *_shell)
{
- sys_unshare(CLONE_FS | CLONE_FILES);
- /* stdin/stdout/stderr for /linuxrc */
- sys_open("/dev/console", O_RDWR, 0);
- sys_dup(0);
- sys_dup(0);
- /* move initrd over / and chdir/chroot in initrd root */
- sys_chdir("/root");
- sys_mount(".", "/", NULL, MS_MOVE, NULL);
- sys_chroot(".");
+ static const char *argv[] = { "linuxrc", NULL, };
+ extern const char *envp_init[];
+ const char *shell = _shell;
+
+ sys_close(old_fd);sys_close(root_fd);
sys_setsid();
- return 0;
+ return sys_execve(shell, argv, envp_init);
}
static void __init handle_initrd(void)
{
- struct subprocess_info *info;
- static char *argv[] = { "linuxrc", NULL, };
- extern char *envp_init[];
int error;
+ int pid;
real_root_dev = new_encode_dev(ROOT_DEV);
create_dev("/dev/root.old", Root_RAM0);
/* mount initrd on rootfs' /root */
mount_block_root("/dev/root.old", root_mountflags & ~MS_RDONLY);
sys_mkdir("/old", 0700);
- sys_chdir("/old");
-
- /* try loading default modules from initrd */
- load_default_modules();
+ root_fd = sys_open("/", 0, 0);
+ old_fd = sys_open("/old", 0, 0);
+ /* move initrd over / and chdir/chroot in initrd root */
+ sys_chdir("/root");
+ sys_mount(".", "/", NULL, MS_MOVE, NULL);
+ sys_chroot(".");
/*
* In case that a resume from disk is carried out by linuxrc or one of
@@ -71,25 +67,27 @@ static void __init handle_initrd(void)
*/
current->flags |= PF_FREEZER_SKIP;
- info = call_usermodehelper_setup("/linuxrc", argv, envp_init,
- GFP_KERNEL, init_linuxrc, NULL, NULL);
- if (!info)
- return;
- call_usermodehelper_exec(info, UMH_WAIT_PROC);
+ pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD);
+ if (pid > 0)
+ while (pid != sys_wait4(-1, NULL, 0, NULL))
+ yield();
current->flags &= ~PF_FREEZER_SKIP;
/* move initrd to rootfs' /old */
- sys_mount("..", ".", NULL, MS_MOVE, NULL);
+ sys_fchdir(old_fd);
+ sys_mount("/", ".", NULL, MS_MOVE, NULL);
/* switch root and cwd back to / of rootfs */
- sys_chroot("..");
+ sys_fchdir(root_fd);
+ sys_chroot(".");
+ sys_close(old_fd);
+ sys_close(root_fd);
if (new_decode_dev(real_root_dev) == Root_RAM0) {
sys_chdir("/old");
return;
}
- sys_chdir("/");
ROOT_DEV = new_decode_dev(real_root_dev);
mount_root();
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next reply other threads:[~2013-08-12 19:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-12 19:44 Andrew Savchenko [this message]
2013-08-27 3:48 ` [BUG] " Andrew Savchenko
2013-09-05 12:08 ` [Suspend-devel] " Pavel Machek
2013-09-05 12:23 ` Rafael J. Wysocki
2013-09-12 8:32 ` Andrew Savchenko
2013-09-18 13:02 ` Pavel Machek
2013-09-18 13:52 ` Al Viro
2013-09-18 15:21 ` Al Viro
2013-09-18 18:40 ` Andrew Savchenko
2013-09-18 19:16 ` Al Viro
2013-09-18 22:13 ` Andrew Savchenko
2013-09-24 0:21 ` [Suspend-devel] " Pavel Machek
2013-10-17 21:35 ` Rafael J. Wysocki
2016-05-22 8:47 ` Andrew Savchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130812234415.7db639bb0d664e56b6ab2ab2@gmail.com \
--to=bircoph@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=suspend-devel@lists.sourceforge.net \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome