diff options
author | Andrew Morton <akpm@osdl.org> | 2006-10-17 03:09:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-17 11:18:43 -0400 |
commit | a649fd9271773dd0f78e2b9f347bcceecb8827f9 (patch) | |
tree | 59b29ffef77a2c5cce233393848c13354f02c0f2 /mm | |
parent | 5eb30790d4ccd3409240a80eaf9ab76b4fb75fd8 (diff) |
[PATCH] invalidate: remove_mapping() fix
If remove_mapping() failed to remove the page from its mapping, don't go and
mark it not uptodate! Makes kernel go dead.
(Actually, I don't think the ClearPageUptodate is needed there at all).
Says Nick Piggin:
"Right, it isn't needed because at this point the page is guaranteed
by remove_mapping to have no references (except us) and cannot pick
up any new ones because it is removed from pagecache.
We can delete it."
Signed-off-by: Andrew Morton <akpm@osdl.org>
Acked-by: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/truncate.c | 1 | ||||
-rw-r--r-- | mm/vmscan.c | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/mm/truncate.c b/mm/truncate.c index 11ca480701dd..e07b1e682c38 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -96,7 +96,6 @@ invalidate_complete_page(struct address_space *mapping, struct page *page) | |||
96 | return 0; | 96 | return 0; |
97 | 97 | ||
98 | ret = remove_mapping(mapping, page); | 98 | ret = remove_mapping(mapping, page); |
99 | ClearPageUptodate(page); | ||
100 | 99 | ||
101 | return ret; | 100 | return ret; |
102 | } | 101 | } |
diff --git a/mm/vmscan.c b/mm/vmscan.c index eca70310adb2..af73c14f9d88 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -378,6 +378,12 @@ static pageout_t pageout(struct page *page, struct address_space *mapping) | |||
378 | return PAGE_CLEAN; | 378 | return PAGE_CLEAN; |
379 | } | 379 | } |
380 | 380 | ||
381 | /* | ||
382 | * Attempt to detach a locked page from its ->mapping. If it is dirty or if | ||
383 | * someone else has a ref on the page, abort and return 0. If it was | ||
384 | * successfully detached, return 1. Assumes the caller has a single ref on | ||
385 | * this page. | ||
386 | */ | ||
381 | int remove_mapping(struct address_space *mapping, struct page *page) | 387 | int remove_mapping(struct address_space *mapping, struct page *page) |
382 | { | 388 | { |
383 | BUG_ON(!PageLocked(page)); | 389 | BUG_ON(!PageLocked(page)); |