NFSv4: ACL in operations 'open' and 'create' should be used
[safe/jmp/linux-2.6] / mm / swap_state.c
index 19bdf30..42cd38e 100644 (file)
@@ -124,7 +124,6 @@ void __delete_from_swap_cache(struct page *page)
 /**
  * add_to_swap - allocate swap space for a page
  * @page: page we want to move to swap
- * @gfp_mask: memory allocation flags
  *
  * Allocate swap space for the page and add the page to the
  * swap cache.  Caller needs to hold the page lock. 
@@ -292,7 +291,10 @@ struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
                /*
                 * Swap entry may have been freed since our caller observed it.
                 */
-               if (!swapcache_prepare(entry))
+               err = swapcache_prepare(entry);
+               if (err == -EEXIST) /* seems racy */
+                       continue;
+               if (err)           /* swp entry is obsolete ? */
                        break;
 
                /*
@@ -311,7 +313,7 @@ struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
                         * Initiate read into locked page and return.
                         */
                        lru_cache_add_anon(new_page);
-                       swap_readpage(NULL, new_page);
+                       swap_readpage(new_page);
                        return new_page;
                }
                ClearPageSwapBacked(new_page);