[patch 2/10] radix-tree locking fix

From: Andrew Morton (akpm@zip.com.au)
Date: Sun May 05 2002 - 15:53:41 EST


__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/



This archive was generated by hypermail 2b29 : Tue May 07 2002 - 22:00:25 EST