Skip to content

Commit 52d1102

Browse files
Alan CoxAndi Kleen
authored andcommitted
snapshot: Push BKL down into ioctl handlers
Push BKL down into ioctl handlers - snapshot device. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Len Brown <len.brown@intel.com> Signed-off-by: Andi Kleen <ak@linux.intel.com>
1 parent ebb12db commit 52d1102

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎kernel/power/user.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/console.h>
2424
#include <linux/cpu.h>
2525
#include <linux/freezer.h>
26+
#include <linux/smp_lock.h>
2627

2728
#include <asm/uaccess.h>
2829

@@ -164,8 +165,8 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf,
164165
return res;
165166
}
166167

167-
static int snapshot_ioctl(struct inode *inode, struct file *filp,
168-
unsigned int cmd, unsigned long arg)
168+
static long snapshot_ioctl(struct file *filp, unsigned int cmd,
169+
unsigned long arg)
169170
{
170171
int error = 0;
171172
struct snapshot_data *data;
@@ -181,6 +182,8 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
181182

182183
data = filp->private_data;
183184

185+
lock_kernel();
186+
184187
switch (cmd) {
185188

186189
case SNAPSHOT_FREEZE:
@@ -389,7 +392,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
389392
error = -ENOTTY;
390393

391394
}
392-
395+
unlock_kernel();
393396
return error;
394397
}
395398

@@ -399,7 +402,7 @@ static const struct file_operations snapshot_fops = {
399402
.read = snapshot_read,
400403
.write = snapshot_write,
401404
.llseek = no_llseek,
402-
.ioctl = snapshot_ioctl,
405+
.unlocked_ioctl = snapshot_ioctl,
403406
};
404407

405408
static struct miscdevice snapshot_device = {

0 commit comments

Comments
 (0)