diff options
Diffstat (limited to 'kernel/power/user.c')
-rw-r--r-- | kernel/power/user.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c index 6b1ab7a88522..3e100075b13c 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -249,13 +249,15 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, | |||
249 | } | 249 | } |
250 | pm_restore_gfp_mask(); | 250 | pm_restore_gfp_mask(); |
251 | error = hibernation_snapshot(data->platform_support); | 251 | error = hibernation_snapshot(data->platform_support); |
252 | if (!error) { | 252 | if (error) { |
253 | thaw_kernel_threads(); | ||
254 | } else { | ||
253 | error = put_user(in_suspend, (int __user *)arg); | 255 | error = put_user(in_suspend, (int __user *)arg); |
254 | if (!error && !freezer_test_done) | 256 | if (!error && !freezer_test_done) |
255 | data->ready = 1; | 257 | data->ready = 1; |
256 | if (freezer_test_done) { | 258 | if (freezer_test_done) { |
257 | freezer_test_done = false; | 259 | freezer_test_done = false; |
258 | thaw_processes(); | 260 | thaw_kernel_threads(); |
259 | } | 261 | } |
260 | } | 262 | } |
261 | break; | 263 | break; |
@@ -274,6 +276,15 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, | |||
274 | swsusp_free(); | 276 | swsusp_free(); |
275 | memset(&data->handle, 0, sizeof(struct snapshot_handle)); | 277 | memset(&data->handle, 0, sizeof(struct snapshot_handle)); |
276 | data->ready = 0; | 278 | data->ready = 0; |
279 | /* | ||
280 | * It is necessary to thaw kernel threads here, because | ||
281 | * SNAPSHOT_CREATE_IMAGE may be invoked directly after | ||
282 | * SNAPSHOT_FREE. In that case, if kernel threads were not | ||
283 | * thawed, the preallocation of memory carried out by | ||
284 | * hibernation_snapshot() might run into problems (i.e. it | ||
285 | * might fail or even deadlock). | ||
286 | */ | ||
287 | thaw_kernel_threads(); | ||
277 | break; | 288 | break; |
278 | 289 | ||
279 | case SNAPSHOT_PREF_IMAGE_SIZE: | 290 | case SNAPSHOT_PREF_IMAGE_SIZE: |