]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix a swap block allocation race.
authormarkj <markj@FreeBSD.org>
Mon, 17 Feb 2020 15:10:41 +0000 (15:10 +0000)
committermarkj <markj@FreeBSD.org>
Mon, 17 Feb 2020 15:10:41 +0000 (15:10 +0000)
commit2f0124a78ff84b54ce79bf4584bdf809b520cada
tree10d07ad92e4a9e7c98f3fe431b026d59a9d8f396
parentb1d25970039f9b19245974fdd6ca97df547cf648
Fix a swap block allocation race.

putpages' allocation of swap blocks is done under the global sw_dev
lock.  Previously it would drop that lock before inserting the allocated
blocks into the object's trie, creating a window in which swap blocks
are allocated but are not visible to swapoff.  This can cause
swp_pager_strategy() to fail and panic the system.

Fix the problem bluntly, by allocating swap blocks under the object
lock.

Reviewed by: jeff, kib
Tested by: pho
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23665
sys/vm/swap_pager.c