From 7f3bc22442d56cbbddf0ac1c2e5680a1c5e7609f Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Tue, 16 Oct 2007 01:24:42 -0700 Subject: [PATCH] --- yaml --- r: 69606 b: refs/heads/master c: b55ed816235cf41c29159d22a4cdeec7deb5821c h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/mm/swap_state.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 95fd2a868453..1a1087e425e0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 45726cb43d11b288c58243a26010f397054222f0 +refs/heads/master: b55ed816235cf41c29159d22a4cdeec7deb5821c diff --git a/trunk/mm/swap_state.c b/trunk/mm/swap_state.c index 67daecb6031a..b52635601dfe 100644 --- a/trunk/mm/swap_state.c +++ b/trunk/mm/swap_state.c @@ -74,6 +74,7 @@ static int __add_to_swap_cache(struct page *page, swp_entry_t entry, { int error; + BUG_ON(!PageLocked(page)); BUG_ON(PageSwapCache(page)); BUG_ON(PagePrivate(page)); error = radix_tree_preload(gfp_mask); @@ -83,7 +84,6 @@ static int __add_to_swap_cache(struct page *page, swp_entry_t entry, entry.val, page); if (!error) { page_cache_get(page); - SetPageLocked(page); SetPageSwapCache(page); set_page_private(page, entry.val); total_swapcache_pages++; @@ -99,15 +99,18 @@ static int add_to_swap_cache(struct page *page, swp_entry_t entry) { int error; + BUG_ON(PageLocked(page)); if (!swap_duplicate(entry)) { INC_CACHE_INFO(noent_race); return -ENOENT; } + SetPageLocked(page); error = __add_to_swap_cache(page, entry, GFP_KERNEL); /* * Anon pages are already on the LRU, we don't run lru_cache_add here. */ if (error) { + ClearPageLocked(page); swap_free(entry); if (error == -EEXIST) INC_CACHE_INFO(exist_race);