lkml.org 
[lkml]   [2009]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] vfs: check inode size on no_cached_page
On Sun, 12 Apr 2009 15:16:05 +0800
Wu Fengguang <fengguang.wu@intel.com> wrote:

> [This patch may not necessarily be merged, but at least we should
> be aware of the problem.]
>
> When user space requests past-EOF data, do_generic_file_read() will
> issue a bonus readpage call, which may be unfavorable.
>
> do_generic_file_read:
> -> find_page:
> -> find_get_page() = NULL
> -> page_cache_sync_readahead()
> -> find_get_page() = NULL
> -> no_cached_page:
> -> readpage:
> -> nfs_readpage() = error
> -> readpage_error:
>
> Reported-by: Xu Chenfeng <xcf@ustc.edu.cn>
> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
> ---
> mm/filemap.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> --- mm.orig/mm/filemap.c
> +++ mm/mm/filemap.c
> @@ -1269,6 +1269,11 @@ readpage_error:
> goto out;
>
> no_cached_page:
> + isize = i_size_read(inode);
> + end_index = (isize - 1) >> PAGE_CACHE_SHIFT;
> + if (unlikely(!isize || index > end_index))
> + goto out;
> +
> /*
> * Ok, it wasn't cached, so we need to create a new
> * page..

Is this a problem which needs to be solved? userspace does something
silly and the kernel behaves a bit suboptimally?

If thats the only problem here then it's not worth adding fastpath
cycles to fix it?




\
 
 \ /
  Last update: 2009-04-15 02:17    [W:0.063 / U:0.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site