aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>2011-12-01 16:33:10 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2011-12-06 16:07:59 -0500
commit97819a26224f019e73d88bb2fd4eb5a614860461 (patch)
treed7bb2f83b2564d4f2bf111e2eb3bc1f4714b342e /kernel
parent0118521cc7acb3ccbc1a01d6144ac32be9d56a4c (diff)
PM / Hibernate: Thaw processes in SNAPSHOT_CREATE_IMAGE ioctl test path
Commit 2aede851ddf08666f68ffc17be446420e9d2a056 (PM / Hibernate: Freeze kernel threads after preallocating memory) moved the freezing of kernel threads to hibernation_snapshot() function. So now, if the call to hibernation_snapshot() returns early due to a successful hibernation test, the caller has to thaw processes to ensure that the system gets back to its original state. But in SNAPSHOT_CREATE_IMAGE hibernation ioctl, the caller does not thaw processes in case hibernation_snapshot() returned due to a successful freezer test. Fix this issue. But note we still send the value of 'in_suspend' (which is now 0) to userspace, because we are not in an error path per-se, and moreover, the value of in_suspend correctly depicts the situation here. Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/hibernate.c2
-rw-r--r--kernel/power/power.h2
-rw-r--r--kernel/power/user.c11
3 files changed, 11 insertions, 4 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 1fcf9de4506d..c10cb0f916e2 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -55,7 +55,7 @@ enum {
55 55
56static int hibernation_mode = HIBERNATION_SHUTDOWN; 56static int hibernation_mode = HIBERNATION_SHUTDOWN;
57 57
58static bool freezer_test_done; 58bool freezer_test_done;
59 59
60static const struct platform_hibernation_ops *hibernation_ops; 60static const struct platform_hibernation_ops *hibernation_ops;
61 61
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 23a2db1ec442..0c4defe6d3b8 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -50,6 +50,8 @@ static inline char *check_image_kernel(struct swsusp_info *info)
50#define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT) 50#define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT)
51 51
52/* kernel/power/hibernate.c */ 52/* kernel/power/hibernate.c */
53extern bool freezer_test_done;
54
53extern int hibernation_snapshot(int platform_mode); 55extern int hibernation_snapshot(int platform_mode);
54extern int hibernation_restore(int platform_mode); 56extern int hibernation_restore(int platform_mode);
55extern int hibernation_platform_enter(void); 57extern int hibernation_platform_enter(void);
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 6d8f535c2b88..e2aff0fc2697 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -283,10 +283,15 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
283 } 283 }
284 pm_restore_gfp_mask(); 284 pm_restore_gfp_mask();
285 error = hibernation_snapshot(data->platform_support); 285 error = hibernation_snapshot(data->platform_support);
286 if (!error) 286 if (!error) {
287 error = put_user(in_suspend, (int __user *)arg); 287 error = put_user(in_suspend, (int __user *)arg);
288 if (!error) 288 if (!error && !freezer_test_done)
289 data->ready = 1; 289 data->ready = 1;
290 if (freezer_test_done) {
291 freezer_test_done = false;
292 thaw_processes();
293 }
294 }
290 break; 295 break;
291 296
292 case SNAPSHOT_ATOMIC_RESTORE: 297 case SNAPSHOT_ATOMIC_RESTORE: