From patchwork Fri Nov 23 00:19:35 2012
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: dm-ioctl: don't use PF_MEMALLOC
Date: Fri, 23 Nov 2012 05:19:35 -0000
From: Mikulas Patocka <mpatocka@redhat.com>
X-Patchwork-Id: 55547
Message-id: <Pine.LNX.4.64.1211221918270.11244@file.rdu.redhat.com>

dm-ioctl: don't use PF_MEMALLOC

PF_MEMALLOC is a hack. Remove it and use documented GFP flags instead.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
drivers/md/dm-ioctl.c |   10 +---------
 drivers/md/dm-ioctl.c |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Index: linux/drivers/md/dm-ioctl.c
===================================================================
--- linux.orig/drivers/md/dm-ioctl.c
+++ linux/drivers/md/dm-ioctl.c
@@ -1559,7 +1559,7 @@ static int copy_params(struct dm_ioctl _
 
 	secure_data = tmp.flags & DM_SECURE_DATA_FLAG;
 
-	dmi = vmalloc(tmp.data_size);
+	dmi = __vmalloc(tmp.data_size, GFP_NOIO | __GFP_REPEAT | __GFP_HIGH, PAGE_KERNEL);
 	if (!dmi) {
 		if (secure_data && clear_user(user, tmp.data_size))
 			return -EFAULT;
@@ -1652,18 +1652,10 @@ static int ctl_ioctl(uint command, struc
 	}
 
 	/*
-	 * Trying to avoid low memory issues when a device is
-	 * suspended.
-	 */
-	current->flags |= PF_MEMALLOC;
-
-	/*
 	 * Copy the parameters into kernel space.
 	 */
 	r = copy_params(user, &param, &input_param_size);
 
-	current->flags &= ~PF_MEMALLOC;
-
 	if (r)
 		return r;
 
