Skip to content

Commit 5023e5c

Browse files
Mikulas Patockakergon
authored andcommitted
dm ioctl: remove PF_MEMALLOC
When allocating memory for the userspace ioctl data, set some appropriate GPF flags directly instead of using PF_MEMALLOC. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
1 parent 7960123 commit 5023e5c

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

drivers/md/dm-ioctl.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,7 +1556,10 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param)
15561556

15571557
secure_data = tmp.flags & DM_SECURE_DATA_FLAG;
15581558

1559-
dmi = vmalloc(tmp.data_size);
1559+
/*
1560+
* Try to avoid low memory issues when a device is suspended.
1561+
*/
1562+
dmi = __vmalloc(tmp.data_size, GFP_NOIO | __GFP_REPEAT | __GFP_HIGH, PAGE_KERNEL);
15601563
if (!dmi) {
15611564
if (secure_data && clear_user(user, tmp.data_size))
15621565
return -EFAULT;
@@ -1656,19 +1659,11 @@ static int ctl_ioctl(uint command, struct dm_ioctl __user *user)
16561659
return -ENOTTY;
16571660
}
16581661

1659-
/*
1660-
* Trying to avoid low memory issues when a device is
1661-
* suspended.
1662-
*/
1663-
current->flags |= PF_MEMALLOC;
1664-
16651662
/*
16661663
* Copy the parameters into kernel space.
16671664
*/
16681665
r = copy_params(user, &param);
16691666

1670-
current->flags &= ~PF_MEMALLOC;
1671-
16721667
if (r)
16731668
return r;
16741669

include/uapi/linux/dm-ioctl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ enum {
268268

269269
#define DM_VERSION_MAJOR 4
270270
#define DM_VERSION_MINOR 23
271-
#define DM_VERSION_PATCHLEVEL 0
272-
#define DM_VERSION_EXTRA "-ioctl (2012-07-25)"
271+
#define DM_VERSION_PATCHLEVEL 1
272+
#define DM_VERSION_EXTRA "-ioctl (2012-12-18)"
273273

274274
/* Status bits */
275275
#define DM_READONLY_FLAG (1 << 0) /* In/Out */

0 commit comments

Comments
 (0)