All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 2/10] radix-tree locking fix
@ 2002-05-05 20:53 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2002-05-05 20:53 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: lkml



__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);
 


-

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-05-05 20:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-05 20:53 [patch 2/10] radix-tree locking fix Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.