[Question] Is there a race window between swapoff vs synchronous swap_readpage

From: Miaohe Lin <linmiaohe@huawei.com>
Date: 2021-03-29 13:19:19
Also in: lkml

Hi all,
I am investigating the swap code, and I found the below possible race window:

CPU 1							CPU 2
-----							-----
do_swap_page
  skip swapcache case (synchronous swap_readpage)
    alloc_page_vma
							swapoff
							  release swap_file, bdev, or ...
      swap_readpage
	check sis->flags is ok
	  access swap_file, bdev or ...[oops!]
							    si->flags = 0

The swapcache case is ok because swapoff will wait on the page_lock of swapcache page.
Is this will really happen or Am I miss something ?
Any reply would be really grateful. Thanks! :)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help