splice: use mapping_gfp_mask
authorHugh Dickins <hugh@veritas.com>
Thu, 3 Apr 2008 22:35:22 +0000 (23:35 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 3 Apr 2008 22:39:49 +0000 (15:39 -0700)
The loop block driver is careful to mask __GFP_IO|__GFP_FS out of its
mapping_gfp_mask, to avoid hangs under memory pressure.  But nowadays
it uses splice, usually going through __generic_file_splice_read.  That
must use mapping_gfp_mask instead of GFP_KERNEL to avoid those hangs.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/splice.c

index 0670c915cd35c5e8b653494d4d5b1efe76867e2e..a861bb318ac83c69ca04ed6dccbc8650e386df20 100644 (file)
@@ -320,7 +320,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
                                break;
 
                        error = add_to_page_cache_lru(page, mapping, index,
-                                             GFP_KERNEL);
+                                               mapping_gfp_mask(mapping));
                        if (unlikely(error)) {
                                page_cache_release(page);
                                if (error == -EEXIST)