]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.7.3/mm-silently-skip-readahead-for-dax-inodes.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.7.3 / mm-silently-skip-readahead-for-dax-inodes.patch
CommitLineData
5a5e98ca
GKH
1From 11bd969fdefea3ac0cb9791224f1e09784e21e58 Mon Sep 17 00:00:00 2001
2From: Ross Zwisler <ross.zwisler@linux.intel.com>
3Date: Thu, 25 Aug 2016 15:17:17 -0700
4Subject: mm: silently skip readahead for DAX inodes
5
6From: Ross Zwisler <ross.zwisler@linux.intel.com>
7
8commit 11bd969fdefea3ac0cb9791224f1e09784e21e58 upstream.
9
10For DAX inodes we need to be careful to never have page cache pages in
11the mapping->page_tree. This radix tree should be composed only of DAX
12exceptional entries and zero pages.
13
14ltp's readahead02 test was triggering a warning because we were trying
15to insert a DAX exceptional entry but found that a page cache page had
16already been inserted into the tree. This page was being inserted into
17the radix tree in response to a readahead(2) call.
18
19Readahead doesn't make sense for DAX inodes, but we don't want it to
20report a failure either. Instead, we just return success and don't do
21any work.
22
23Link: http://lkml.kernel.org/r/20160824221429.21158-1-ross.zwisler@linux.intel.com
24Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
25Reported-by: Jeff Moyer <jmoyer@redhat.com>
26Cc: Dan Williams <dan.j.williams@intel.com>
27Cc: Dave Chinner <david@fromorbit.com>
28Cc: Dave Hansen <dave.hansen@linux.intel.com>
29Cc: Jan Kara <jack@suse.com>
30Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
31Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
32Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
33
34---
35 mm/readahead.c | 9 +++++++++
36 1 file changed, 9 insertions(+)
37
38--- a/mm/readahead.c
39+++ b/mm/readahead.c
40@@ -8,6 +8,7 @@
41 */
42
43 #include <linux/kernel.h>
44+#include <linux/dax.h>
45 #include <linux/gfp.h>
46 #include <linux/export.h>
47 #include <linux/blkdev.h>
48@@ -545,6 +546,14 @@ do_readahead(struct address_space *mappi
49 if (!mapping || !mapping->a_ops)
50 return -EINVAL;
51
52+ /*
53+ * Readahead doesn't make sense for DAX inodes, but we don't want it
54+ * to report a failure either. Instead, we just return success and
55+ * don't do any work.
56+ */
57+ if (dax_mapping(mapping))
58+ return 0;
59+
60 return force_page_cache_readahead(mapping, filp, index, nr);
61 }
62