]>
Commit | Line | Data |
---|---|---|
5a5e98ca GKH |
1 | From 11bd969fdefea3ac0cb9791224f1e09784e21e58 Mon Sep 17 00:00:00 2001 |
2 | From: Ross Zwisler <ross.zwisler@linux.intel.com> | |
3 | Date: Thu, 25 Aug 2016 15:17:17 -0700 | |
4 | Subject: mm: silently skip readahead for DAX inodes | |
5 | ||
6 | From: Ross Zwisler <ross.zwisler@linux.intel.com> | |
7 | ||
8 | commit 11bd969fdefea3ac0cb9791224f1e09784e21e58 upstream. | |
9 | ||
10 | For DAX inodes we need to be careful to never have page cache pages in | |
11 | the mapping->page_tree. This radix tree should be composed only of DAX | |
12 | exceptional entries and zero pages. | |
13 | ||
14 | ltp's readahead02 test was triggering a warning because we were trying | |
15 | to insert a DAX exceptional entry but found that a page cache page had | |
16 | already been inserted into the tree. This page was being inserted into | |
17 | the radix tree in response to a readahead(2) call. | |
18 | ||
19 | Readahead doesn't make sense for DAX inodes, but we don't want it to | |
20 | report a failure either. Instead, we just return success and don't do | |
21 | any work. | |
22 | ||
23 | Link: http://lkml.kernel.org/r/20160824221429.21158-1-ross.zwisler@linux.intel.com | |
24 | Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> | |
25 | Reported-by: Jeff Moyer <jmoyer@redhat.com> | |
26 | Cc: Dan Williams <dan.j.williams@intel.com> | |
27 | Cc: Dave Chinner <david@fromorbit.com> | |
28 | Cc: Dave Hansen <dave.hansen@linux.intel.com> | |
29 | Cc: Jan Kara <jack@suse.com> | |
30 | Signed-off-by: Andrew Morton <akpm@linux-foundation.org> | |
31 | Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> | |
32 | Signed-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 |