Skip to content

Commit

Permalink
[PATCH] invalidate: remove_mapping() fix
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Oct 17, 2006
1 parent 5eb3079 commit a649fd9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion mm/truncate.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ invalidate_complete_page(struct address_space *mapping, struct page *page)
return 0;

ret = remove_mapping(mapping, page);
ClearPageUptodate(page);

return ret;
}
Expand Down
6 changes: 6 additions & 0 deletions mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,12 @@ static pageout_t pageout(struct page *page, struct address_space *mapping)
return PAGE_CLEAN;
}

/*
* Attempt to detach a locked page from its ->mapping. If it is dirty or if
* someone else has a ref on the page, abort and return 0. If it was
* successfully detached, return 1. Assumes the caller has a single ref on
* this page.
*/
int remove_mapping(struct address_space *mapping, struct page *page)
{
BUG_ON(!PageLocked(page));
Expand Down

0 comments on commit a649fd9

Please sign in to comment.