Commit c855ff37 authored by David Howells's avatar David Howells Committed by Linus Torvalds

Fix a bad error case handling in read_cache_page_async()

Commit 6fe6900e introduced a nasty bug
in read_cache_page_async().

It added a "mark_page_accessed(page)" at the final return path in
read_cache_page_async().  But in error cases, 'page' holds the error
code, and you can't mark it accessed.

[ and Glauber de Oliveira Costa points out that we can use a return
  instead of adding more goto's ]
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Acked-by: default avatarNick Piggin <npiggin@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent aabded9c
...@@ -1784,7 +1784,7 @@ struct page *read_cache_page_async(struct address_space *mapping, ...@@ -1784,7 +1784,7 @@ struct page *read_cache_page_async(struct address_space *mapping,
retry: retry:
page = __read_cache_page(mapping, index, filler, data); page = __read_cache_page(mapping, index, filler, data);
if (IS_ERR(page)) if (IS_ERR(page))
goto out; return page;
mark_page_accessed(page); mark_page_accessed(page);
if (PageUptodate(page)) if (PageUptodate(page))
goto out; goto out;
...@@ -1802,9 +1802,9 @@ retry: ...@@ -1802,9 +1802,9 @@ retry:
err = filler(data, page); err = filler(data, page);
if (err < 0) { if (err < 0) {
page_cache_release(page); page_cache_release(page);
page = ERR_PTR(err); return ERR_PTR(err);
} }
out: out:
mark_page_accessed(page); mark_page_accessed(page);
return page; return page;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment