Skip to contentSkip to conversation

Fix a bad bug in read_cache_page_async()

PATCH In review David Howells 3 participants 4 messages May 9, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix a bad bug in read_cache_page_async()

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.

---

 mm/filemap.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
mm/filemap.c +4 -2
index 9e56fd1..10d4fcf 100644
@@ -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);
#1 lore raw

mm/filemap.c struct page *read_cache_page_async(struct address_space *mapping, · line 1787

Quoted 4 lines
        page = __read_cache_page(mapping, index, filler, data);
        if (IS_ERR(page))
mm/filemap.c +1 -1
-               goto out;
+               goto error;

any reason for not simply returning page here?

Quoted 2 lines
                page = ERR_PTR(err);

+ goto error;

same

Signature · 4 lines
Glauber de Oliveira Costa.
"Free as in Freedom"

"The less confident you are, the more serious you have to act."
#2 lore raw
Quoted 1 line · Glauber de Oliveira Costa

any reason for not simply returning page here?

Not particularly.

David

#3 lore raw
In reply to David Howells
Quoted 10 lines · David Howells

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.

Quoted 33 lines

---

 mm/filemap.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
mm/filemap.c +4 -2
index 9e56fd1..10d4fcf 100644
@@ -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);