Introduce a hack that will make geom_gate to work with read-only mounts.

Now, when trying to mount file system in read-only mode it tries to
opened a device for writting to be able to update to read-write mode
latter. Ehh.

Discussed with:	phk
This commit is contained in:
Pawel Jakub Dawidek 2004-06-27 12:56:11 +00:00
parent d1458cfdf4
commit 55336b83e0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=131188

View File

@ -174,8 +174,11 @@ g_gate_access(struct g_provider *pp, int dr, int dw, int de)
sc = pp->geom->softc;
if (sc == NULL || (sc->sc_flags & G_GATE_FLAG_DESTROY) != 0)
return (ENXIO);
/* XXX: Hack to allow read-only mounts. */
#if 0
if ((sc->sc_flags & G_GATE_FLAG_READONLY) != 0 && dw > 0)
return (EPERM);
#endif
if ((sc->sc_flags & G_GATE_FLAG_WRITEONLY) != 0 && dr > 0)
return (EPERM);
return (0);
@ -195,8 +198,14 @@ g_gate_start(struct bio *bp)
G_GATE_LOGREQ(2, bp, "Request received.");
switch (bp->bio_cmd) {
case BIO_READ:
break;
case BIO_DELETE:
case BIO_WRITE:
/* XXX: Hack to allow read-only mounts. */
if ((sc->sc_flags & G_GATE_FLAG_READONLY) != 0) {
g_io_deliver(bp, EPERM);
return;
}
break;
case BIO_GETATTR:
default: