NetBSD Problem Report #833
From gnats Wed Mar 1 21:19:57 1995
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.10/8.6.10) with ESMTP id VAA04105 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Wed, 1 Mar 1995 21:19:55 -0800
Message-Id: <199503020427.VAA23498@amiga2.oscs.montana.edu>
Date: Wed, 1 Mar 1995 21:27:09 -0700
From: osymh@lightning.oscs.montana.edu
Reply-To: osymh@lightning.oscs.montana.edu
To: gnats-bugs@NetBSD.ORG
Subject: Mini-root support does not work
X-Send-Pr-Version: 3.2
>Number: 833
>Category: kern
>Synopsis: Mini-root support (GENERIC option) will panic
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Mar 01 21:20:02 +0000 1995
>Closed-Date: Sat Jan 06 23:39:53 +0000 1996
>Last-Modified: Sat Jan 06 23:44:06 +0000 1996
>Originator: Michael L. Hitch
>Release: NetBSD-current 02/26/95<NetBSD-current source date>
>Organization:
" Montana State University"
>Environment:
System: NetBSD amiga2.oscs.montana.edu 1.0A NetBSD 1.0A (ZEUS) #950213-0: Tue Feb 14 00:23:01 MST 1995 root@amiga2.oscs.montana.edu:/altroot/tmp/src/sys/arch/amiga/compile/ZEUS amiga
>Description:
When using the mini-root support (booting with a mini-root file
system on the swap partition), swapinit will panic with swfree 0.
This is because swfree() attempts to open the swap device, but
gets EBUSY because the swap device is already open due to the
root filesystem at the beginning of the swap partition is
mounted.
>How-To-Repeat:
Compile a kernel with the GENERIC option. Copy a small root file
system to the beginning of the swap partition (I used the Amiga
floppy installation file system). Boot using the mini-root
filesystem (on the Amiga, use "loadbsd -b ..." and enter sd0*
at the root device prompt).
>Fix:
A possible fix is to ignore the EBUSY error return in swfree if
the mini-root is being used:
diff -cr /usr/src/sys/vm/vm_swap.c sys/vm/vm_swap.c
*** /usr/src/sys/vm/vm_swap.c Mon Jan 9 04:19:25 1995
--- sys/vm/vm_swap.c Wed Mar 1 21:02:48 1995
***************
*** 349,356 ****
sp = &swdevt[index];
vp = sp->sw_vp;
! if (error = VOP_OPEN(vp, FREAD|FWRITE, p->p_ucred, p))
! return (error);
sp->sw_flags |= SW_FREED;
nblks = sp->sw_nblks;
/*
--- 349,365 ----
sp = &swdevt[index];
vp = sp->sw_vp;
! if (error = VOP_OPEN(vp, FREAD|FWRITE, p->p_ucred, p)) {
! #ifdef GENERIC
! /*
! * If using mini-root, the swap device is already
! * opened from the root mount. If device is busy,
! * ignore the error.
! */
! if (error != EBUSY || rootdev != dumpdev)
! #endif
! return (error);
! }
sp->sw_flags |= SW_FREED;
nblks = sp->sw_nblks;
/*
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: pk
State-Changed-When: Sat Jan 6 18:39:53 EST 1996
State-Changed-Why:
Should be fixed in current revision of <sys/vm_swap.c>.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.