mm/hwpoison: fix PageHWPoison test/set race
authorWanpeng Li <[email protected]>
Tue, 8 Sep 2015 22:03:13 +0000 (15:03 -0700)
committerLinus Torvalds <[email protected]>
Tue, 8 Sep 2015 22:35:28 +0000 (15:35 -0700)
commit1e0e635be82132167a134b5a9c884e70e61f8373
treebe7f964bee75f72d71df0bde9b6844b9fa4286d6
parent7d1900c744b2e4687b3e467edf58373c02bcf22d
mm/hwpoison: fix PageHWPoison test/set race

There is a race between madvise_hwpoison path and memory_failure:

 CPU0 CPU1

madvise_hwpoison
get_user_pages_fast
PageHWPoison check (false)
memory_failure
TestSetPageHWPoison
soft_offline_page
PageHWPoison check (true)
return -EBUSY (without put_page)

Signed-off-by: Wanpeng Li <[email protected]>
Suggested-by: Naoya Horiguchi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/memory-failure.c