diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2013-07-10 18:41:15 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2013-07-10 18:41:15 -0400 |
commit | 1c0e883e86ece31880fac2f84b260545d66a39e0 (patch) | |
tree | b56dd76ef7c1c0598af5b830e2a3d8f8a38f772b | |
parent | 6c182cd88d179cbbd06f4f8a8a19b6977940753f (diff) |
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@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
-rw-r--r-- | drivers/md/dm-ioctl.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index aa04f0224642..81a79b739e97 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c | |||
@@ -1644,7 +1644,10 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl *param_kern | |||
1644 | } | 1644 | } |
1645 | 1645 | ||
1646 | if (!dmi) { | 1646 | if (!dmi) { |
1647 | unsigned noio_flag; | ||
1648 | noio_flag = memalloc_noio_save(); | ||
1647 | dmi = __vmalloc(param_kernel->data_size, GFP_NOIO | __GFP_REPEAT | __GFP_HIGH, PAGE_KERNEL); | 1649 | dmi = __vmalloc(param_kernel->data_size, GFP_NOIO | __GFP_REPEAT | __GFP_HIGH, PAGE_KERNEL); |
1650 | memalloc_noio_restore(noio_flag); | ||
1648 | if (dmi) | 1651 | if (dmi) |
1649 | *param_flags |= DM_PARAMS_VMALLOC; | 1652 | *param_flags |= DM_PARAMS_VMALLOC; |
1650 | } | 1653 | } |