From nobody@FreeBSD.org  Tue Nov  8 19:50:51 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4198610656F3
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  8 Nov 2011 19:50:51 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 3111B8FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  8 Nov 2011 19:50:51 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id pA8JooIg051420
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 8 Nov 2011 19:50:50 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id pA8JooTh051419;
	Tue, 8 Nov 2011 19:50:50 GMT
	(envelope-from nobody)
Message-Id: <201111081950.pA8JooTh051419@red.freebsd.org>
Date: Tue, 8 Nov 2011 19:50:50 GMT
From: Garrett Cooper <yaneurabeya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Orphaned swap references not garbage collected; renders impossible to remove
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         162382
>Category:       kern
>Synopsis:       [swap] Orphaned swap references not garbage collected; renders impossible to remove
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 08 20:00:24 UTC 2011
>Closed-Date:    
>Last-Modified:  Sun Feb 03 22:29:46 UTC 2013
>Originator:     Garrett Cooper
>Release:        9.0-RC1
>Organization:
iXsystems, Inc.
>Environment:
FreeBSD bayonetta.local 9.0-RC1 FreeBSD 9.0-RC1 #0: Sat Nov  5 17:19:05 PDT 2011     root@bayonetta.local:/usr/obj/store/freebsd/stable/9/sys/BAYONETTA  amd64
>Description:
If one sets up multiple swaps that are striped across disks and one goes
south, the kernel retains a reference to the lost swap, but unfortunately
doesn't remove the phantom reference; furthermore, the user can't remove
the phantom reference, because the bogus device doesn't exist. This can
cause issues if the swap was being used, either at a kernel or userland
level.

Eventually [with mps at least] the system gets cranky and kicks the device
out of some subsystems, but doesn't get rid of the bogus reference -- thus
it could cause serious issues if a process tries to swap back from the
phantom swap device.

What I'm recommending is that the phantom reference be reaped immediately.
This should trickle up through all affected subsystems (GEOM -> vm -> etc).
Any processes trying to access memory that was swapped out should be
SIGKILLed immediately in a worst case scenario, but other potentially more
graceful (or quicker) methods of notifying affected processes could be
employed so processes that carve out a large chunk of memory that's gone
MIA (SIGABRT? SIGSEGV?).

delphij@ might have more details or context into the underlying issue.
>How-To-Repeat:
1. Install FreeBSD on a system with an HBA or gmirror that's capable of
   hotswap and setup the RAID in a redundant manner.
2. Setup swaps on multiple devices in a striped manner.
3. Yank a disk with a swap on it.
4. Look at swapctl -l; you'll see a gobbledygook reference to a dead
   device (something like "/dev/C@#$A6^7").
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:
