From nobody@FreeBSD.org  Mon Apr 21 18:28:56 2008
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 AF7231065672
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 21 Apr 2008 18:28:56 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id A5BD68FC19
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 21 Apr 2008 18:28:56 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m3LISZXr080005
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 21 Apr 2008 18:28:35 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m3LISZui080004;
	Mon, 21 Apr 2008 18:28:35 GMT
	(envelope-from nobody)
Message-Id: <200804211828.m3LISZui080004@www.freebsd.org>
Date: Mon, 21 Apr 2008 18:28:35 GMT
From: Paul <onemda@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: md swapfile multiplication after init 1
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         122968
>Category:       conf
>Synopsis:       [rc.d] /etc/rc.d/addswap: md swapfile multiplication after init 1
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-rc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 21 18:30:04 UTC 2008
>Closed-Date:    
>Last-Modified:  Thu Oct 25 20:10:00 UTC 2012
>Originator:     Paul
>Release:        FreeBSD 8.0 Current
>Organization:
>Environment:
FreeBSD i386 8.0 Current
>Description:
Having swapfile defined in rc.conf
will create duplication of memory disk device after executing init 1 as root
swapinfo will report md0 and md1 as swapdevices and top will report duplicated (2x) swap (impossiblie)

I did not look if other problems may arise when this error happen (swap was not used at all)


>How-To-Repeat:
create swapfile with dd (as explained in handbook) and add its full name in /etc/rc.conf

notice swapinfo and top output after executing # init 1
>Fix:
Before adding swapfile check if it already exist with mdconfig -l -u X
where X is mdX number of previous swapfile.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: jh 
Responsible-Changed-When: Mon Jul 5 18:11:13 UTC 2010 
Responsible-Changed-Why:  
Reassign. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=122968 

From: Chris Rees <utisoft@gmail.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: conf/122968
Date: Thu, 25 Oct 2012 21:04:20 +0100

 This is a problem indeed, and can easily be fixed with this hint from
 the submitter.
 
 While in this file, we can use REQUIRE in netif rather than BEFORE in addswap.
 
 Would anyone care to approve?
 
 http://www.bayofrum.net/~crees/patches/122968.diff
 
 Chris
>Unformatted:
