NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

how do I mount a read-only filesystem from the "root device" prompt?



So with Xen one can export a "disk" (disk, file, LVM partiion, etc.)
with "access=ro", and that is enforced.

However if one tries to mount such a disk in a domU as root, it fails.

When one first looks at the code which does the initial vfs_mountroot it
would appear to be correct -- i.e. it is trying to open the root
filesystem device for reading it uses VOP_OPEN() to open the root
device with FREAD (which I think means "only for reading"):

		error = VOP_OPEN(rootvp, FREAD, FSCRED);
		if (error) {
			printf("vfs_mountroot: can't open root device, error = %d\n", error);
			return (error);
		}

However something assumes that if it is like a disk (i.e. but not a
CD-ROM/DVD) then it tries to open for write too as we get:

	root on dk1
	vfs_mountroot: can't open root device, error = 30
	cannot mount root, error = 30

(errno #30 is of course EROFS)

I'm not even sure where this is happening.

vfs_rootmountalloc() does indeed set MNT_RDONLY, but this error is
happening before vfs_mountroot() calls ffs_mountroot (through the
vfs_mountroot pointer).

So I'm lost -- any hints?  Is it from bounds_check_with_label()?  How?

--
					Greg A. Woods <gwoods%acm.org@localhost>

Kelowna, BC     +1 250 762-7675           RoboHack <woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>     Avoncote Farms <woods%avoncote.ca@localhost>

Attachment: pgp8lXyRNyewG.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index