aboutsummaryrefslogtreecommitdiff
path: root/drivers/md/dm-bufio.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-10 09:02:50 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-10 09:02:50 -0700
commitec6671589a07d9b27ff5832138ff435b3a3c9b09 (patch)
tree4866cfd09e45a492b5b96380818fb5d1e3a4fac0 /drivers/md/dm-bufio.c
parentf755407dd19072b7d20719bc5454caed9ab41cc1 (diff)
parent2f14f4b51ed34fe2b704af8df178f5cd8c81f65e (diff)
Merge tag 'dm-3.10-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm
Pull device-mapper updates from Alasdair Kergon: "Allow devices that hold metadata for the device-mapper thin provisioning target to be extended easily; allow WRITE SAME on multipath devices; an assortment of little fixes and clean-ups." * tag 'dm-3.10-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm: (21 commits) dm cache: set config value dm cache: move config fns dm thin: generate event when metadata threshold passed dm persistent metadata: add space map threshold callback dm persistent data: add threshold callback to space map dm thin: detect metadata device resizing dm persistent data: support space map resizing dm thin: open dev read only when possible dm thin: refactor data dev resize dm cache: replace memcpy with struct assignment dm cache: fix typos in comments dm cache policy: fix description of lookup fn dm: document iterate_devices dm persistent data: fix error message typos dm cache: tune migration throttling dm mpath: enable WRITE SAME support dm table: fix write same support dm bufio: avoid a possible __vmalloc deadlock dm snapshot: fix error return code in snapshot_ctr dm cache: fix error return code in cache_create ...
Diffstat (limited to 'drivers/md/dm-bufio.c')
-rw-r--r--drivers/md/dm-bufio.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index c6083132c4b8..0387e05cdb98 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -319,6 +319,9 @@ static void __cache_size_refresh(void)
static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
enum data_mode *data_mode)
{
+ unsigned noio_flag;
+ void *ptr;
+
if (c->block_size <= DM_BUFIO_BLOCK_SIZE_SLAB_LIMIT) {
*data_mode = DATA_MODE_SLAB;
return kmem_cache_alloc(DM_BUFIO_CACHE(c), gfp_mask);
@@ -332,7 +335,26 @@ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
}
*data_mode = DATA_MODE_VMALLOC;
- return __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL);
+
+ /*
+ * __vmalloc allocates the data pages and auxiliary structures with
+ * gfp_flags that were specified, but pagetables are always allocated
+ * with GFP_KERNEL, no matter what was specified as gfp_mask.
+ *
+ * Consequently, we must set per-process flag PF_MEMALLOC_NOIO so that
+ * all allocations done by this process (including pagetables) are done
+ * as if GFP_NOIO was specified.
+ */
+
+ if (gfp_mask & __GFP_NORETRY)
+ noio_flag = memalloc_noio_save();
+
+ ptr = __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL);
+
+ if (gfp_mask & __GFP_NORETRY)
+ memalloc_noio_restore(noio_flag);
+
+ return ptr;
}
/*