HomeFreeBSD

Fix a swap block allocation race.

Description

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

Details

Provenance
markjAuthored on
Reviewer
jeff
Differential Revision
D23665: Fix a swap block allocation race.
Parents
rS358024: Fix object locking races in swapoff(2).
Branches
Unknown
Tags
Unknown