Current-Users archive

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

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



At Sun, 4 Apr 2021 01:19:44 -0700, John Nemeth <jnemeth%cue.bc.ca@localhost> wrote:
Subject: Re: how do I mount a read-only filesystem from the "root device" prompt?
>
>      Given that it is possible to have partitions on CDs, which is
> common on Suns, but not so much elsewhere, and that anywhere there
> is a partition, there is the possibility of using wedges, it would
> seem that this is essential.

I would think it's not just CDs and hypervisor-provided virtual devices
that can have multiple partitions, use wedges, and yet be read-only.

Are not a wide variety of removable storage devices also capable of
being made "read-only" at the hardware level?

On Apr 4,  7:34, Michael van Elst wrote:
>
> I suggested to make it open read-only if it gets EROFS and to validate
> the open mode against what is possible in this state.

Given the layers of devices and code involved, perhaps it might be
possible to just honour the original mode requested by the code opening
the first partition to mount a filesystem, and then to upgrade the vnode
to write mode if/when that mount is upgraded to write mode or another rw
mount is attempted on another partition on the same device?

I realize there's nothing like VOP_REOPEN() to change the open mode
flags, but if I'm not mistaken that wouldn't be too difficult to
implement.

Anyway I did find this is where the actual EROFS is being returned, and
perhaps changing it to EACCES would be less confusing, or maybe not....

--- sys/arch/xen/xen/xbd_xenbus.c.~1.129.~	2021-02-28 15:45:22.000000000 -0800
+++ sys/arch/xen/xen/xbd_xenbus.c	2021-04-04 14:21:01.006355121 -0700
@@ -950,7 +950,7 @@
 	if (sc == NULL)
 		return (ENXIO);
 	if ((flags & FWRITE) && (sc->sc_info & VDISK_READONLY))
-		return EROFS;
+		return EACCES;

 	DPRINTF(("xbdopen(%" PRIx64 ", %d)\n", dev, flags));
 	return dk_open(&sc->sc_dksc, dev, flags, fmt, l);



--
					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: pgprPg4ex2j0Y.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index