Commit 22eca178 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] radix-tree locking fix

__delete_from_swap_cache modifies the radix tree.  We need to take the
lock for writing.
parent 038de6b6
...@@ -308,13 +308,13 @@ int remove_exclusive_swap_page(struct page *page) ...@@ -308,13 +308,13 @@ int remove_exclusive_swap_page(struct page *page)
retval = 0; retval = 0;
if (p->swap_map[SWP_OFFSET(entry)] == 1) { if (p->swap_map[SWP_OFFSET(entry)] == 1) {
/* Recheck the page count with the pagecache lock held.. */ /* Recheck the page count with the pagecache lock held.. */
read_lock(&swapper_space.page_lock); write_lock(&swapper_space.page_lock);
if (page_count(page) - !!PagePrivate(page) == 2) { if (page_count(page) - !!PagePrivate(page) == 2) {
__delete_from_swap_cache(page); __delete_from_swap_cache(page);
SetPageDirty(page); SetPageDirty(page);
retval = 1; retval = 1;
} }
read_unlock(&swapper_space.page_lock); write_unlock(&swapper_space.page_lock);
} }
swap_info_put(p); swap_info_put(p);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment