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.
Showing the changes to include (1 of 3 files). Show all
Unified · Split
| @@ -55,7 +55,8 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping, · 54 unmodified lines | ||
| 55 | 55 | struct page *newpage, struct page *page); |
| 56 | 56 | extern int migrate_page_move_mapping(struct address_space *mapping, |
| 57 | 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 | 60 | #else |
| 60 | 61 | |
| 61 | 62 | static inline void putback_lru_pages(struct list_head *l) {} |