mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Fix a bad bug in read_cache_page_async()
@ 2007-05-09 12:02 David Howells
  2007-05-09 12:07 ` Glauber de Oliveira Costa
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Howells @ 2007-05-09 12:02 UTC (permalink / raw)
  To: torvalds, akpm, npiggin; +Cc: linux-kernel, dhowells

Fix a bad bug in read_cache_page_async() introduced in commit:

	6fe6900e1e5b6fa9e5c59aa5061f244fe3f467e2

This adds:

	mark_page_accessed(page)

into the error handling path in read_cache_page_async().  In such a case,
'page' holds the error code.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 mm/filemap.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 9e56fd1..10d4fcf 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1784,7 +1784,7 @@ struct page *read_cache_page_async(struct address_space *mapping,
 retry:
 	page = __read_cache_page(mapping, index, filler, data);
 	if (IS_ERR(page))
-		goto out;
+		goto error;
 	mark_page_accessed(page);
 	if (PageUptodate(page))
 		goto out;
@@ -1803,9 +1803,11 @@ retry:
 	if (err < 0) {
 		page_cache_release(page);
 		page = ERR_PTR(err);
+		goto error;
 	}
- out:
+out:
 	mark_page_accessed(page);
+error:
 	return page;
 }
 EXPORT_SYMBOL(read_cache_page_async);


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix a bad bug in read_cache_page_async()
  2007-05-09 12:02 [PATCH] Fix a bad bug in read_cache_page_async() David Howells
@ 2007-05-09 12:07 ` Glauber de Oliveira Costa
  2007-05-09 12:19 ` Nick Piggin
  2007-05-09 12:22 ` David Howells
  2 siblings, 0 replies; 4+ messages in thread
From: Glauber de Oliveira Costa @ 2007-05-09 12:07 UTC (permalink / raw)
  To: David Howells; +Cc: torvalds, akpm, npiggin, linux-kernel

>         page = __read_cache_page(mapping, index, filler, data);
>         if (IS_ERR(page))
> -               goto out;
> +               goto error;
any reason for not simply returning page here?


>                 page = ERR_PTR(err);
> +               goto error;
same


-- 
Glauber de Oliveira Costa.
"Free as in Freedom"

"The less confident you are, the more serious you have to act."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix a bad bug in read_cache_page_async()
  2007-05-09 12:02 [PATCH] Fix a bad bug in read_cache_page_async() David Howells
  2007-05-09 12:07 ` Glauber de Oliveira Costa
@ 2007-05-09 12:19 ` Nick Piggin
  2007-05-09 12:22 ` David Howells
  2 siblings, 0 replies; 4+ messages in thread
From: Nick Piggin @ 2007-05-09 12:19 UTC (permalink / raw)
  To: David Howells; +Cc: torvalds, akpm, linux-kernel

On Wed, May 09, 2007 at 01:02:01PM +0100, David Howells wrote:
> Fix a bad bug in read_cache_page_async() introduced in commit:
> 
> 	6fe6900e1e5b6fa9e5c59aa5061f244fe3f467e2
> 
> This adds:
> 
> 	mark_page_accessed(page)
> 
> into the error handling path in read_cache_page_async().  In such a case,
> 'page' holds the error code.

Obvious thinko. Thanks, ack.

> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> ---
> 
>  mm/filemap.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 9e56fd1..10d4fcf 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -1784,7 +1784,7 @@ struct page *read_cache_page_async(struct address_space *mapping,
>  retry:
>  	page = __read_cache_page(mapping, index, filler, data);
>  	if (IS_ERR(page))
> -		goto out;
> +		goto error;
>  	mark_page_accessed(page);
>  	if (PageUptodate(page))
>  		goto out;
> @@ -1803,9 +1803,11 @@ retry:
>  	if (err < 0) {
>  		page_cache_release(page);
>  		page = ERR_PTR(err);
> +		goto error;
>  	}
> - out:
> +out:
>  	mark_page_accessed(page);
> +error:
>  	return page;
>  }
>  EXPORT_SYMBOL(read_cache_page_async);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix a bad bug in read_cache_page_async()
  2007-05-09 12:02 [PATCH] Fix a bad bug in read_cache_page_async() David Howells
  2007-05-09 12:07 ` Glauber de Oliveira Costa
  2007-05-09 12:19 ` Nick Piggin
@ 2007-05-09 12:22 ` David Howells
  2 siblings, 0 replies; 4+ messages in thread
From: David Howells @ 2007-05-09 12:22 UTC (permalink / raw)
  To: Glauber de Oliveira Costa; +Cc: torvalds, akpm, npiggin, linux-kernel

Glauber de Oliveira Costa <glommer@gmail.com> wrote:

> any reason for not simply returning page here?

Not particularly.

David

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-05-09 12:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-09 12:02 [PATCH] Fix a bad bug in read_cache_page_async() David Howells
2007-05-09 12:07 ` Glauber de Oliveira Costa
2007-05-09 12:19 ` Nick Piggin
2007-05-09 12:22 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome