[ 3.8.y.z extended stable ] Patch "dm ioctl: set noio flag to avoid __vmalloc deadlock" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Tue Jul 16 22:54:04 UTC 2013


This is a note to let you know that I have just added a patch titled

    dm ioctl: set noio flag to avoid __vmalloc deadlock

to the linux-3.8.y-queue branch of the 3.8.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.8.y-queue

This patch is scheduled to be released in version 3.8.13.5.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.8.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

>From ff1aaf9a90e1874ace1b722018aff5e1a61c00b0 Mon Sep 17 00:00:00 2001
From: Mikulas Patocka <mpatocka at redhat.com>
Date: Wed, 10 Jul 2013 23:41:15 +0100
Subject: dm ioctl: set noio flag to avoid __vmalloc deadlock

Set noio flag while calling __vmalloc() because it doesn't fully respect
gfp flags to avoid a possible deadlock (see commit
502624bdad3dba45dfaacaf36b7d83e39e74b2d2).

This should be backported to stable kernels 3.8 and newer. The kernel 3.8
doesn't have memalloc_noio_save(), so we should set and restore process
flag PF_MEMALLOC instead.

Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>
Signed-off-by: Alasdair G Kergon <agk at redhat.com>
[ kamal: backport to 3.8 (memalloc_noio_save is available in linux-3.8.y.z) ]
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 drivers/md/dm-ioctl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index eee353d..4c260aa 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1585,7 +1585,10 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param, in
 		dmi = kmalloc(tmp.data_size, GFP_NOIO | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN);

 	if (!dmi) {
+		unsigned noio_flag;
+		noio_flag = memalloc_noio_save();
 		dmi = __vmalloc(tmp.data_size, GFP_NOIO | __GFP_REPEAT | __GFP_HIGH, PAGE_KERNEL);
+		memalloc_noio_restore(noio_flag);
 		*param_flags |= DM_PARAMS_VMALLOC;
 	}

--
1.8.1.2





More information about the kernel-team mailing list