summaryrefslogtreecommitdiffstats
path: root/kernel/power/user.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-08 03:21:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-08 03:21:31 +0000
commit5dca02f2ee931aef66bb21dd8067c8b1af1e0d3e (patch)
tree6581b770eb1bd6cac1252a5451b89c092ea4c797 /kernel/power/user.c
parentAdding debian version 4.19.249-2. (diff)
downloadlinux-5dca02f2ee931aef66bb21dd8067c8b1af1e0d3e.tar.xz
linux-5dca02f2ee931aef66bb21dd8067c8b1af1e0d3e.zip
Merging upstream version 4.19.260.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'kernel/power/user.c')
-rw-r--r--kernel/power/user.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 2d8b60a3c..6a11154b3 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -29,6 +29,7 @@
#include "power.h"
+static bool need_wait;
#define SNAPSHOT_MINOR 231
@@ -82,7 +83,7 @@ static int snapshot_open(struct inode *inode, struct file *filp)
* Resuming. We may need to wait for the image device to
* appear.
*/
- wait_for_device_probe();
+ need_wait = true;
data->swap = -1;
data->mode = O_WRONLY;
@@ -174,6 +175,11 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf,
ssize_t res;
loff_t pg_offp = *offp & ~PAGE_MASK;
+ if (need_wait) {
+ wait_for_device_probe();
+ need_wait = false;
+ }
+
lock_system_sleep();
data = filp->private_data;
@@ -209,6 +215,11 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
loff_t size;
sector_t offset;
+ if (need_wait) {
+ wait_for_device_probe();
+ need_wait = false;
+ }
+
if (_IOC_TYPE(cmd) != SNAPSHOT_IOC_MAGIC)
return -ENOTTY;
if (_IOC_NR(cmd) > SNAPSHOT_IOC_MAXNR)