|
@@ -324,9 +324,16 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
|
|
if (found_page)
|
|
if (found_page)
|
|
break;
|
|
break;
|
|
|
|
|
|
- /* Just skip read ahead for unused swap slot */
|
|
|
|
- if (!__swp_swapcount(entry))
|
|
|
|
- return NULL;
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Just skip read ahead for unused swap slot.
|
|
|
|
+ * During swap_off when swap_slot_cache is disabled,
|
|
|
|
+ * we have to handle the race between putting
|
|
|
|
+ * swap entry in swap cache and marking swap slot
|
|
|
|
+ * as SWAP_HAS_CACHE. That's done in later part of code or
|
|
|
|
+ * else swap_off will be aborted if we return NULL.
|
|
|
|
+ */
|
|
|
|
+ if (!__swp_swapcount(entry) && swap_slot_cache_enabled)
|
|
|
|
+ break;
|
|
|
|
|
|
/*
|
|
/*
|
|
* Get a new page to read into from swap.
|
|
* Get a new page to read into from swap.
|