History

aio/migratepages: make aio migrate pages sane

The arbitrary restriction on page counts offered by the core migrate_page_move_mapping() code results in rather suspicious looking fiddling with page reference counts in the aio_migratepage() operation. To fix this, make migrate_page_move_mapping() take an extra_count parameter that allows aio to tell the code about its own reference count on the page being migrated. While cleaning up aio_migratepage(), make it validate that the old page being passed in is actually what aio_migratepage() expects to prevent misbehaviour in the case of races.

Benjamin LaHaise committed 12 years ago

Commit 8e321fe1 parent 18816863 files · +53 −15Browse files

Showing the changes to include (1 of 3 files). Show all

Unified · Split

include/linux/migrate.h+2−1
@@ -55,7 +55,8 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping, · 54 unmodified lines
55 struct page *newpage, struct page *page);55 struct page *newpage, struct page *page);
56extern int migrate_page_move_mapping(struct address_space *mapping,56extern int migrate_page_move_mapping(struct address_space *mapping,
57 struct page *newpage, struct page *page,57 struct page *newpage, struct page *page,
58 struct buffer_head *head, enum migrate_mode mode);58 struct buffer_head *head, enum migrate_mode mode,
59 int extra_count);
59#else60#else
60 61
61static inline void putback_lru_pages(struct list_head *l) {}62static inline void putback_lru_pages(struct list_head *l) {}