Skip to content

Commit

Permalink
Revert "mm/shmem: fix shmem_swapin() race with swapoff"
Browse files Browse the repository at this point in the history
This reverts commit a533a21 which is
commit 2efa33f upstream.

It should not have been added to the stable trees, sorry about that.

Link: https://lore.kernel.org/r/YPVgaY6uw59Fqg5x@casper.infradead.org
Reported-by: From: Matthew Wilcox <willy@infradead.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Ying Huang <ying.huang@intel.com>
Cc: Alex Shi <alexs@kernel.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: Yang Shi <shy828301@gmail.com>
Cc: Yu Zhao <yuzhao@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
gregkh committed Jul 25, 2021
1 parent 58d7ce3 commit b33e80b
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions mm/shmem.c
Expand Up @@ -1696,21 +1696,14 @@ static int shmem_swapin_page(struct inode *inode, pgoff_t index,
struct address_space *mapping = inode->i_mapping;
struct shmem_inode_info *info = SHMEM_I(inode);
struct mm_struct *charge_mm = vma ? vma->vm_mm : current->mm;
struct swap_info_struct *si;
struct page *page = NULL;
struct page *page;
swp_entry_t swap;
int error;

VM_BUG_ON(!*pagep || !xa_is_value(*pagep));
swap = radix_to_swp_entry(*pagep);
*pagep = NULL;

/* Prevent swapoff from happening to us. */
si = get_swap_device(swap);
if (!si) {
error = EINVAL;
goto failed;
}
/* Look it up and read it in.. */
page = lookup_swap_cache(swap, NULL, 0);
if (!page) {
Expand Down Expand Up @@ -1772,8 +1765,6 @@ static int shmem_swapin_page(struct inode *inode, pgoff_t index,
swap_free(swap);

*pagep = page;
if (si)
put_swap_device(si);
return 0;
failed:
if (!shmem_confirm_swap(mapping, index, swap))
Expand All @@ -1784,9 +1775,6 @@ static int shmem_swapin_page(struct inode *inode, pgoff_t index,
put_page(page);
}

if (si)
put_swap_device(si);

return error;
}

Expand Down

0 comments on commit b33e80b

Please sign in to comment.