Skip to contentSkip to conversation

PM/Hibernate: Thaw kernel threads in SNAPSHOT_CREATE_IMAGE ioctl path

PATCH Applied Srivatsa S. Bhat 2 participants 2 messages Jan 30, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM/Hibernate: Thaw kernel threads in SNAPSHOT_CREATE_IMAGE ioctl path

In the SNAPSHOT_CREATE_IMAGE ioctl, if the call to hibernation_snapshot() fails, the frozen tasks are not thawed.

And in the case of success, if we happen to exit due to a successful freezer test, all tasks (including those of userspace) are thawed, whereas actually we should have thawed only the kernel threads at that point. Fix both these issues.

---
This applies on top of the patch posted at https://lkml.org/lkml/2012/1/27/501

 kernel/power/user.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
kernel/power/user.c +4 -2
index e5a21a8..3e10007 100644
@@ -249,13 +249,15 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
 		}
 		pm_restore_gfp_mask();
 		error = hibernation_snapshot(data->platform_support);
-		if (!error) {
+		if (error) {
+			thaw_kernel_threads();
+		} else {
 			error = put_user(in_suspend, (int __user *)arg);
 			if (!error && !freezer_test_done)
 				data->ready = 1;
 			if (freezer_test_done) {
 				freezer_test_done = false;
-				thaw_processes();
+				thaw_kernel_threads();
 			}
 		}
 		break;
#1 lore raw
Quoted 10 lines · Srivatsa S. Bhat

In the SNAPSHOT_CREATE_IMAGE ioctl, if the call to hibernation_snapshot() fails, the frozen tasks are not thawed.

And in the case of success, if we happen to exit due to a successful freezer test, all tasks (including those of userspace) are thawed, whereas actually we should have thawed only the kernel threads at that point. Fix both these issues.

Applied.

Thanks,
Rafael

Quoted 32 lines

---
This applies on top of the patch posted at https://lkml.org/lkml/2012/1/27/501

 kernel/power/user.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
kernel/power/user.c +4 -2
index e5a21a8..3e10007 100644
@@ -249,13 +249,15 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
 		}
 		pm_restore_gfp_mask();
 		error = hibernation_snapshot(data->platform_support);
-		if (!error) {
+		if (error) {
+			thaw_kernel_threads();
+		} else {
 			error = put_user(in_suspend, (int __user *)arg);
 			if (!error && !freezer_test_done)
 				data->ready = 1;
 			if (freezer_test_done) {
 				freezer_test_done = false;
-				thaw_processes();
+				thaw_kernel_threads();
 			}
 		}
 		break;