NFS diskless operation was broken because swapdev_vp wasn't initialized.

These changes solve the problem in a general way by moving the
initialization out of the individual fs_mountroot's and into swaponvp().

Submitted by:	Poul-Henning Kamp
This commit is contained in:
David Greenman 1995-05-19 03:27:08 +00:00
parent 977a407e1d
commit 2976b7f19f
6 changed files with 24 additions and 19 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.3 (Berkeley) 1/31/94
* $Id: cd9660_vfsops.c,v 1.10 1995/01/16 17:03:27 joerg Exp $
* $Id: cd9660_vfsops.c,v 1.11 1995/03/16 20:23:24 wollman Exp $
*/
#include <sys/param.h>
@ -94,10 +94,10 @@ cd9660_mountroot()
struct iso_args args;
/*
* Get vnodes for swapdev and rootdev.
* Get vnode for rootdev.
*/
if (bdevvp(swapdev, &swapdev_vp) || bdevvp(rootdev, &rootvp))
panic("cd9660_mountroot: can't setup bdevvp's");
if (bdevvp(rootdev, &rootvp))
panic("cd9660_mountroot: can't setup bdevvp for rootdev");
mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK);
bzero((char *)mp, (u_long)sizeof(struct mount));

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.3 (Berkeley) 1/31/94
* $Id: cd9660_vfsops.c,v 1.10 1995/01/16 17:03:27 joerg Exp $
* $Id: cd9660_vfsops.c,v 1.11 1995/03/16 20:23:24 wollman Exp $
*/
#include <sys/param.h>
@ -94,10 +94,10 @@ cd9660_mountroot()
struct iso_args args;
/*
* Get vnodes for swapdev and rootdev.
* Get vnode for rootdev.
*/
if (bdevvp(swapdev, &swapdev_vp) || bdevvp(rootdev, &rootvp))
panic("cd9660_mountroot: can't setup bdevvp's");
if (bdevvp(rootdev, &rootvp))
panic("cd9660_mountroot: can't setup bdevvp for rootdev");
mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK);
bzero((char *)mp, (u_long)sizeof(struct mount));

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
* $Id: init_main.c,v 1.23 1995/05/04 08:21:24 davidg Exp $
* $Id: init_main.c,v 1.24 1995/05/14 02:59:55 davidg Exp $
*/
#include <sys/param.h>
@ -94,7 +94,7 @@ struct proc *initproc, *pageproc, *updateproc, *vmproc;
int cmask = CMASK;
extern struct user *proc0paddr;
struct vnode *rootvp, *swapdev_vp;
struct vnode *rootvp;
int boothowto;
struct timeval boottime;
struct timeval runtime;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94
* $Id: ffs_vfsops.c,v 1.18 1995/05/01 23:20:24 dyson Exp $
* $Id: ffs_vfsops.c,v 1.19 1995/05/15 08:39:37 davidg Exp $
*/
#include <sys/param.h>
@ -105,10 +105,10 @@ ffs_mountroot()
int error;
/*
* Get vnodes for swapdev and rootdev.
* Get vnode for rootdev.
*/
if (bdevvp(swapdev, &swapdev_vp) || bdevvp(rootdev, &rootvp))
panic("ffs_mountroot: can't setup bdevvp's");
if (bdevvp(rootdev, &rootvp))
panic("ffs_mountroot: can't setup bdevvp for root");
mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK);
bzero((char *)mp, (u_long)sizeof(struct mount));

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)mfs_vfsops.c 8.4 (Berkeley) 4/16/94
* $Id: mfs_vfsops.c,v 1.6 1995/03/16 18:16:54 bde Exp $
* $Id: mfs_vfsops.c,v 1.7 1995/04/25 03:39:50 phk Exp $
*/
#include <sys/param.h>
@ -101,10 +101,10 @@ mfs_mountroot()
int error;
/*
* Get vnodes for swapdev and rootdev.
* Get vnode for rootdev.
*/
if (bdevvp(swapdev, &swapdev_vp) || bdevvp(rootdev, &rootvp))
panic("mfs_mountroot: can't setup bdevvp's");
if (bdevvp(rootdev, &rootvp))
panic("mfs_mountroot: can't setup bdevvp for rootdev");
mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK);
bzero((char *)mp, (u_long)sizeof(struct mount));

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)vm_swap.c 8.5 (Berkeley) 2/17/94
* $Id: vm_swap.c,v 1.17 1995/05/14 03:00:10 davidg Exp $
* $Id: vm_swap.c,v 1.18 1995/05/18 05:09:54 davidg Exp $
*/
#include <sys/param.h>
@ -58,6 +58,7 @@
#endif
static struct swdevt should_be_malloced[NSWAPDEV];
struct swdevt *swdevt = should_be_malloced;
struct vnode *swapdev_vp;
int nswap; /* first block after the interleaved devs */
int nswdev = NSWAPDEV;
int vm_swap_size;
@ -249,5 +250,9 @@ swaponvp(p, vp, dev, nblks)
rlist_free(&swaplist, vsbase, vsbase + blk - 1);
vm_swap_size += blk;
}
if (!swapdev_vp && bdevvp(swapdev, &swapdev_vp))
panic("Cannot get vnode for swapdev");
return (0);
}