Skip to contentSkip to conversation

radix-tree locking fix

PATCH In review Andrew Morton 1 participant 1 message May 5, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/10 radix-tree locking fix

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

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

mm/swapfile.c renamed from mm/swapfile.c~swap-lock-fix +2 -2
@@ -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);
 

-