[patch 2/10] radix-tree locking fix

Andrew Morton (akpm@zip.com.au)
Sun, 05 May 2002 13:53:41 -0700


__delete_from_swap_cache modifies the radix tree. We need to take the
lock for writing.

=====================================

--- 2.5.13/mm/swapfile.c~swap-lock-fix Sun May 5 13:31:59 2002
+++ 2.5.13-akpm/mm/swapfile.c Sun May 5 13:31:59 2002
@@ -308,13 +308,13 @@ int remove_exclusive_swap_page(struct pa
retval = 0;
if (p->swap_map[SWP_OFFSET(entry)] == 1) {
/* 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) {
__delete_from_swap_cache(page);
SetPageDirty(page);
retval = 1;
}
- read_unlock(&swapper_space.page_lock);
+ write_unlock(&swapper_space.page_lock);
}
swap_info_put(p);

-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/